Incomplete wiki tutorial


03-10-2008 09:06:03

The code snipped presented in the line 3D tutorial is incomplete. The code will not display any line. You need to set a node position to make the line show.

SceneNode moNode = Osm.RootSceneNode.CreateChildSceneNode("line_node");
moNode.SetPosition((float)0, (float)0, (float)0); // this line needed


03-10-2008 20:48:23

Thanks for your reply!
This is no tutorial, just a commented code snippet.
Now I see the explanation is not the best and I should update it.

Yes, for this example I forgot to set the node position. If I remember right, in my test application I attached the ManualObject directly to the RootSceneNode. So I forgot the node position.
I corrected it in the wiki.

moNode.SetPosition((float)0, (float)0, (float)0);
Alternatively you can write
moNode.SetPosition(0f, 0f, 0f);
moNode.Position = Vector3.ZERO;

An other question:
Are there default materials defined (for base colours like blue) inside of Ogre?


04-10-2008 07:33:30


If I want to put lines at he end of hands of my character how can I get position of the hands? Can I get bones position and use it for start position of the lines?


04-10-2008 09:38:21

sorry, I have no idea about bones.
I just used static models.
The best place to ask this would be to search/ask in the main forum.
Also ask if it's possible to get its orientation.
(If you get an answer, please give us a link to the thread)

If you have a point, you can set the line.
You need minimum 2 points.

* Attach the moNode to RootSceneNode
* Take the point of the hand as first point (in our case use its WorldPosition)
* Calculate the second point (by the WorldPosition and WorldOrientation of the first point and an offset vector)

If the length of the line doesn't change, you don't need to destroy / recreate it for each frame. The you just need to update its position / orientation.


04-10-2008 16:38:31

OK, I will search.

I'm happy because I found that I can attach a node to another (in fact, I know this, but I forget it, so I have less calculation to make moving my kite when my character move and be oriented. I can go ahead now.

Did you know if I can found somewhere a way to make film within OGRE animation, is someone make this? I try by saving frame but it' s very too slow to save on disk, I think I will save in memory then on disk but have no idea to achieve that.


05-10-2008 05:44:36

Yes, it's also possible to attach nodes to an other one. When you set the position and orientation is always related to its parent. If you want to set worldCoordinates / worldOrientation to a subnode then you have to calculate it by using the target values against the worldPosition/worldOrientation of the parent.
Maybe there is also a property for SceneNodes to ignore parent values. I think I remember something like this.

For you problem you have to decide if you wand to use the global or local coordinate system.


I also wrote some (unready) code for video taking. The ogre function is very very slow. Much more faster is to get it by the Windows API(?), GDI(?). If you like I can look for the code when I'm at home.

One problem is that you have to write much data to hard disk nearly in real time. Save it to the memory needs to much space.
In my application I send the pictures to a second thread that is running on an other CPU kernel. This thread made a jpg compression, which is a good improvement. But still it needs a high hard disk writing speed.

The other problem is to get the right timing. The movements of a scene (also sliding textures) should be synchronized to the record speed.
If you make a screenshot every frame, then you have a jitter (different time spans between the frames).

An other easy way:
Use the program FRAPS. Many people use it to capture videos of games. I think is had an own codec for this purpose. There is a free demo tool of it. Try it.


05-10-2008 06:58:08

Thanks for answers.

I know fraps, but if I want to take long video, I must pay. I have a free tools called CamStudio, but it will be cool if I can have the system in my prog so other users can take video with it. But it is not the priority now, by the way.


05-10-2008 10:55:09

My capture methods are integrated to my application. I'm not shure if it's easy to extract it.
Basicly it works, but it's unfinished for good using.

If there is an interest by other people to create fast screenshots or videos, I can publish my code.
Maybe we can improve it and make a capture class together.


05-10-2008 12:14:52

Yeah, I'm very interested. However, I have to advance on my code, video capture function, if one exists a day in my soft, wel be implemented on a future version. For now, it's just an idea of future improvement.


06-10-2008 11:04:10

I'm interested in video capture. I had a ten second go at doing it, and found the screen capture too slow with my basic method. It's not really high in my priority list at the moment so can't really spend much time on it.