I have 2 objects that I wish to draw one above the other and I would like some advice on how this could be done.
I have
- Sphere --> world pos = 0,0,0
- Cube --> world pos = 0,0,1
So if the camera is at (0,0,5) looking at (0,0,0)
Calling pSceneManager->drawAll() would render the Cube in "front" of the Sphere
Now I wish to render the Cube "behind" the Sphere while keeping all my objects in their respective positions.
In pseudo code, here is what I did
Hide the Sphere
Show the Cube
pSceneManager->drawAll()
Show the Sphere
Hide the Cube
pSceneManager->drawAll()
Now doing that, I would expect the Sphere to be drawn on to of the Cube that is not the case. Can anyone hint on what I've done wrong please.
Drawing order
First mistake is that the Z axis is not up/down, its front/back !!!
So if you want a node on top of another you'll have to set the Y axis !!!
X -> left/right
Y -> up/down
Z -> front/back
then, your pseudo code is the complete render loop ???
then the second drawAll() erases/overrides the first drawAll() !!!
and finally I don't know what you really want ???
once you say "cube behind sphere" and then "one on top of the other" ???
So if you want a node on top of another you'll have to set the Y axis !!!
X -> left/right
Y -> up/down
Z -> front/back
then, your pseudo code is the complete render loop ???
then the second drawAll() erases/overrides the first drawAll() !!!
and finally I don't know what you really want ???
once you say "cube behind sphere" and then "one on top of the other" ???
while(!asleep) sheep++;
IrrExtensions:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
IrrExtensions:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
By on top i think he means rendered in front of, so he does understand that the z axis is forward/back.
I also wondered if the drawAll would draw over the previous drawing, but if he had only the cube and the sphere in the scene and nothing else would it not work? I wondered if drawAll clears the scene and then redraws, but i guess it's driver->beginScene that does the clearing.
Out of interest, what's the reason for this? Maybe there's some other way round it.
I also wondered if the drawAll would draw over the previous drawing, but if he had only the cube and the sphere in the scene and nothing else would it not work? I wondered if drawAll clears the scene and then redraws, but i guess it's driver->beginScene that does the clearing.
Out of interest, what's the reason for this? Maybe there's some other way round it.