glDrawTexiOES z parameter on mx31

Am working on the mx31 platform

I am facing issues when using both glDrawArrays and glDrawTexiOES.

I use glDrawArrays to draw various objects on screen, and glDrawTexiOES to draw the background image. The way the architecture is, the foreground objects are drawn first, and then the background.

Now glDrawTexiOES draws on top of whatever glDrawArrays has drawn irrespective of what z values are given to glDrawArrays.

The z values I have tried with glDrawTexiOES is 1 and -1. Both ways, the background is drawn in front of the foreground objects.

Am I doing something wrong? What is the correct value of z for glDrawTexiOES on MX31? Thanks in advance!

If you want to draw a background the correct z value for glDrawTexiOES likely is 1, unless you’ve inverted your depth range for better precision with a floating point depth buffer.

Are you sure depth test is enabled when you draw the background?

Yes I am sure…

This is enough to enable it right:
glEnable(GL_DEPTH_TEST);

Are there any other state settings concerning the depth buffer in your application, especially in between the rendering of the foreground objects and the call to glDrawTexiOES?

Here is what the code structure looks like:

InitApp()
loop forever:
RenderOGLObjects()
RenderBkgdScreen()

Detailed pseudocode:

InitApp
{
//eglInitialize,chooseconfig, createwindowssurface, etc

//create screen texture (glGenTex, glTexImage2D)
//glViewPort(x,y,w,h)
//glMatrixMode(GL_MODELVIEW)
//glLoadIdentity()
//glortho(0,w, 0, h, -100,100);
}

RenderOGLObjects()
{
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();

//enable/disable textures,blending, etc
//use glFrustum/glOrtho
//rotate/translate/scale etc
////draw objects

glMatrixMode(GL_MODELVIEW);
glPopMatrix();
glMatrixMode(GL_PROJECTION);
glPopMatrix();
}

RenderBkgdScreen()
{
//enable textures, depth testing
//croprect, gltexenv, glTexparameter calls
//gltexSubImage2d, with screen buffer
//glDrawTexioes(z = 1/-1/10/-10)
//eglSwapBuffers
}

Anything smell fishy?

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.