I have been learning DirectX for a while now & I got to the point of drawing multiple objects to the screen from .obj files. My problem is that if I draw 2 objects, the 2nd draw will be on top of the 1st.
Example:
Obj1 = Cardboard box
Obj2 = Cube
loadStuff_&_draw(Obj1);
loadStuff_&_draw(Obj2);
That would draw the cube outside/front the box even if it is in/behind.
How would I make multiple objects draw together so that they overlap correctly?
The only drawing things I know of are:
- Load vertex, index, constant buffers
- updateSubresource()
- drawIndexed()
Edit:
Here is a picture of a cube in a box. It shows that the cube is behind the box rather than inside. It also shows that the rim of the box clips behind the box. Not sure what happened.
I drew the cube, then drew the hollow box.