If you haven't done so already, be sure to visit the Wiki Portal to read about how the wiki works. Especially the Ogre Wiki Overview page.
Using a ManualObject you don't need to load ressources and it's nice to create dynamic objects or simple ones.
To do so, you define the needed points (vertices), rendering type (points, lines, surfaces) and assign a material. To add it to the scene, it has to be attached to a SceneNode (e.g. the RootSceneNode).
Several begin / end blocks can be added to the same ManualObject, so you can use different materials and rendering types. As a result you can get lines, surfaces or a combination of it. Transparency is also possible (by using materials with transparency property). If several instances are needed, you have to create a mesh by using ManualObject::convertToMesh().
In some cases the identity projection can be interesting. With this the coordinates are in 2D screen space of the current camera. Useful for overlay rendering.
Example
A very minimal example that gives an outlined square (or quad):
ManualObject* manual = mSceneMgr->createManualObject("manual"); manual->begin("BaseWhiteNoLighting", RenderOperation::OT_LINE_STRIP); manual->position(-100.0, -100.0, 0.0); manual->position( 100.0, -100.0, 0.0); manual->position( 100.0, 100.0, 0.0); manual->position(-100.0, 100.0, 0.0); manual->end(); mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(manual);
If you want to update (change) the ManualObject later or create a Mesh out of it, you have to add indices.
ManualObject* manual = mSceneMgr->createManualObject("manual"); manual->begin("BaseWhiteNoLighting", RenderOperation::OT_LINE_STRIP); manual->position(-100.0, -100.0, 0.0); manual->position( 100.0, -100.0, 0.0); manual->position( 100.0, 100.0, 0.0); manual->position(-100.0, 100.0, 0.0); manual->index(0); manual->index(1); manual->index(2); manual->index(3); manual->index(0); manual->end(); mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(manual);
Rendering Types
enum Ogre::RenderOperation::OperationType
| OT_POINT_LIST | A list of points | 1 vertex per point |
| OT_LINE_LIST | A list of lines | 2 vertices per line |
| OT_LINE_STRIP | A strip of connected lines  | 1 start vertex and 1 vertex per line |
| OT_TRIANGLE_LIST | A list of triangles | 3 vertices per triangle |
| OT_TRIANGLE_STRIP | A strip of triangles | 3 vertices for the first triangle and 1 per triangle after that |
| OT_TRIANGLE_FAN | A fan of triangles | 3 vertices for the first triangle and 1 per triangle after that |
See Also
|
Contributors to this page: jacmoe
,
spacegaier
,
PrisonerOfPain
and
Beauty
.
Page last modified on Monday 28 of June, 2010 21:52:55 GMT by jacmoe
.
The content on this page is licensed under the terms of the Creative Commons Attribution-ShareAlike License.
As an exception, any source code contributed within the content is released into the Public Domain.

