Well you have verified that your context is working. Sending NDC isn't very common so who knows how tested it is.

Here is what I would try:

1) Try an emulator and an actual device and see if there is something different.
2) Change the order of your tests and see if anything changes.
3) Swap the view port line for 2 & 3 and see if that changes anything.
4) Use glLoadMatrix to load the identity. Perhaps the driver is being to smart for it's own good. If it works that's scary.

Leigh

On 6/26/2010 12:03 PM, satlan esh wrote:
Thanks everybody.

@ Leigh&  Indicator: Sorry if I wan't clear enough. There's really not
much to it: nothing is being drawn when projection is set to identity.
All values are fixed point, and there's no mixing with floats.
@ openglguy: The coordinates are already NDC, so there's no need for
any sort of projection, just plain identity.


Here's a simple gl code that reproduces the problem:

glClear(GL_COLOR_BUFFER_BIT);

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();

// Eye coordinates - frustum projection. Ok
{
        glViewport(0,0,width,height/3);

        glMatrixMode(GL_PROJECTION);
        glLoadIdentity();
        glFrustumf(-1,1,-1,1,1,10);

        GLfloat v[3*4]={        -1,     1,      -2,     1,
                        -1,     -1,     -2,     1,
                        1,      1,      -2,     1};

        glVertexPointer(4,GL_FLOAT,0,v);

        glDrawArrays(GL_TRIANGLES,0,3);
}

// Normalized device coordinates - identity projection. Draws nothing
{
        glViewport(0,height/3,width,height/3);

        glMatrixMode(GL_PROJECTION);
        glLoadIdentity();

        GLfloat v[3*4]={        -0.5,   0.5,    0.111111,       1,
                        -0.5,   -0.5,   0.111111,       1,
                        0.5,    0.5,    0.111111,       1};

        glVertexPointer(4,GL_FLOAT,0,v);

        glDrawArrays(GL_TRIANGLES,0,3);
}

// Normalized device coordinates - "almost identity" projection. Ok
{
        glViewport(0,2*height/3,width,height/3);

        glMatrixMode(GL_PROJECTION);
        GLfloat id[4*4]={       1.001,  0,      0,      0,
                        0,      1.001,  0,      0,
                        0,      0,      1.001,  0,
                        0,      0,      0,      1.001};
        glLoadMatrixf(id);

        GLfloat v[3*4]={        -0.5,   0.5,    0.111111,       1,
                        -0.5,   -0.5,   0.111111,       1,
                        0.5,    0.5,    0.111111,       1};

        glVertexPointer(4,GL_FLOAT,0,v);

        glDrawArrays(GL_TRIANGLES,0,3);
}

It draws three identical triangles: The first uses eye coordiantes and
a frustum projection matrix. This one works fine.
The second uses the already transformed NDC and an identity projection
matrix. This one draws nothing on Android (but works ok on other
platforms).
The third one passes the same NDC, but uses a projection matrix that's
almost identity. This one draws.

Although the third approach is the closest I got to a solution, my
intentions are that a true identity projection matrix will implicitly
spare the unneeded projection transformation altogehter.

I hope this clarifies the problem.


--
Leigh McRae
www.lonedwarfgames.com

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to