I’m having troubles here to draw multiple meshes.
For example a object that spin around another object.
Both has different texture, different shader behaviors.
So I created 2 Programs to work with it, one Program for each object.
Everything work OK,
If I render each object alone.
But, when I place all togheter… here is my problem.
The last call to glDrawElements always draw above the last. So the objects don’t seems to be in the same 3D space, seems more as one 2D image above another (like two render buffers).
Look, here are a screen of my problem, the tetrahedron should stay behind the cude at this time, not in front of it:
What is the correct way to work with multiple meshes?
Some informations about my code:
• OpenGL ES 2.0
• Enabled CULL_FACES
• Using VBO, IBO
• Using different Programs and Shaders for each object.
As you know, in Cocoa Touch, Apple give it own EGL (EAGL) that don’t work with swapBuffer behavior, instead this, it draw to a renderBuffer and after present this buffer to the screen.
Well, I’m thinking if it can be a problem, if I need to use a renderDepthBuffer to solve this.
Well, anyone have any idea?
What is the correct way to render multiple meshes in the same scene using OpenGL ES 2.0?