ManualObject 2D         Demonstrates an easy way to use ManualObject for creating 2D overlays
Print

Note: You should use a material that has lighting and depth write turned off for this to behave correctly. See Displaying 2D Backgrounds for an example how to set up such a material programmatically.

// Create a manual object for 2D
ManualObject* manual = mSceneMgr->createManualObject("manual");
 
// Use identity view/projection matrices
manual->setUseIdentityProjection(true);
manual->setUseIdentityView(true);
 
manual->begin("BaseWhiteNoLighting", RenderOperation::OT_LINE_STRIP);
 
manual->position(-0.2, -0.2, 0.0);
manual->position( 0.2, -0.2, 0.0);
manual->position( 0.2,  0.2, 0.0);
manual->position(-0.2,  0.2, 0.0);
 
manual->index(0);
manual->index(1);
manual->index(2);
manual->index(3);
manual->index(0);
 
manual->end();
 
// Use infinite AAB to always stay visible
AxisAlignedBox aabInf;
aabInf.setInfinite();
manual->setBoundingBox(aabInf);
 
// Render just before overlays
manual->setRenderQueueGroup(RENDER_QUEUE_OVERLAY - 1);
 
// Attach to scene
mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(manual);

Gives an outlined rectangle in the middle of the screen that is always visible.

See also

 


Alias: ManualObject_2D


Contributors to this page: spacegaier3733 points  , Spacegaier3733 points  and jacmoe111451 points  .
Page last modified on Tuesday 09 of November, 2010 11:49:32 GMT by spacegaier3733 points .


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.