r1cky17
04-11-2007 09:24:24
hi, i load an image using Material
the image is :
1. time in right - top
2. speedometer in right - bottom
it's work like this
the car position is (58.5801, 0.605723, 53.6801)
but if the car position in (147.566, 0.739556, 103.042) the image gone like this
i already use setWorldSize(Vector3(-100000,-100000,-100000), Vector3(100000,100000,100000));
how to show the image in every area in the world?
thx
Lioric
05-11-2007 14:41:59
How are those "images" loaded or created in your application, are they overlays or a plane mesh?
You can use overlays to have a 2d image that is part of your user interface (similar to the Ogre debug overlays)
If they are a plane positionated in front of the camera, you can link them to the camera and they will matain their position in front of the camera as you move it
r1cky17
05-11-2007 15:02:59
MaterialPtr material = MaterialManager::getSingleton().create("Background", "General");
material->getTechnique(0)->getPass(0)->createTextureUnitState("speedometer.png");
material->getTechnique(0)->getPass(0)->setSceneBlending(SBT_TRANSPARENT_ALPHA );
material->getTechnique(0)->getPass(0)->setDepthCheckEnabled(false);
material->getTechnique(0)->getPass(0)->setDepthWriteEnabled(false);
material->getTechnique(0)->getPass(0)->setLightingEnabled(false);
Rectangle2D* rect = new Rectangle2D(true);
Real L = -0.375;
Real R = L + 0.75;
Real T = -0.12;
Real B = T - 1.0;
rect->setCorners(L, T, R, B);
rect->setMaterial("Background");
rect->setRenderQueueGroup(RENDER_QUEUE_WORLD_GEOMETRY_1);
rect->setBoundingBox(AxisAlignedBox(-100.0*Vector3::UNIT_SCALE, 100.0*Vector3::UNIT_SCALE));
SceneNode* node = mSceneMgr->getRootSceneNode()->createChildSceneNode("Background");
node->attachObject(rect);
for setRenderQueueGroup, i use 2 tipe
rect->setRenderQueueGroup(RENDER_QUEUE_OVERLAY);
rect->setRenderQueueGroup(RENDER_QUEUE_WORLD_GEOMETRY_1);
Lioric
06-11-2007 03:09:44
Is there any particular reason why you dont use overlays?
r1cky17
06-11-2007 08:54:15
i don't know how to change from one overlay to another overlay.
and i use that because i have so many menu in my game.
so using that, it make easier for me
Lioric
10-11-2007 01:58:22
Probably it would be easier if you use overlays (that is their purpose, to show screen ui's)
What do you mean by change overlay to another?
Define overlays in your ".overlay" file, they can be in the same position if you need, then in your application, use the overlay manager to get a pointer to the overlay(s) you want to change using its name (as defined in the .overlay file) hide the overlay and show the other (that way you can change separated overlays)
Or if you need more complex UIs, use any of the several UI libraries for ogre, there are many of them and mostly some will suit your needs
r1cky17
11-11-2007 19:20:18
hi, my code is working, here is the mistake
rect->setBoundingBox(AxisAlignedBox(-100.0*Vector3::UNIT_SCALE, 100.0*Vector3::UNIT_SCALE));
and change it to
rect->setBoundingBox(AxisAlignedBox(-100000.0*Vector3::UNIT_SCALE, 100000.0*Vector3::UNIT_SCALE));
thx for the help