# OpenGL glOrthox with GLES does not seem to work properly

This topic is 3673 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Experiencing some weird problems with glOrthox in my GLES application for Windows Mobile. Here is the code I have (I only use orthographic projection):
// Setup orthographic projection.
RECT r;
GetClientRect(m_rAttributes.Window, &r);

glMatrixMode(GL_PROJECTION);
glOrthox(Fix(0), Fix(r.right), Fix(0), Fix(r.bottom), Fix(-1), Fix(1));
glMatrixMode(GL_MODELVIEW);


The problem is that the origin (0,0) is in the LOWER left corner instead of the upper left corner, as it should be. Putting Fix(r.bottom) as the third param and Fix(0) as the fourth does not fix the problem, it makes it worse, I see nothing on the screen that way. I've also tried putting Fix(-r.bottom) as the fourth parameter, but that did not work either.. Seems like the orthographic setup for GLES is much different from regular OpenGL. Never had any problems before. Any help is greatly appreciated.

##### Share on other sites
hi,

it is just a guess cause i do not have a lot of experience with OpenGL but did you set the Viewport somewhere?

if the viewport is not set properly i think something like that could happen.

##### Share on other sites
Yeah, I set the viewport.

Perspective projection works perfectly, however. Just checked that.

##### Share on other sites
i just looked at the Prototype of glOrthox:

void glOrthox(GLfixed left,GLfixed right,GLfixed bottom,GLfixed top, GLfixed near, GLfixed far)

so if you want to get it to work you should switch the third and fourth param.

For testing you could set the glOrthox without the RECT so you can check if it works properly then.

Something like:
glOrthox(Fix(0), Fix(800), Fix(600), Fix(0), Fix(-1), Fix(1));

if it works that way it would definitly be a Problem with the RECT.

##### Share on other sites
Damn... nevermind.. solved it. Had back-face culling on and the wrong indice-order in my vertex array.

##### Share on other sites
glad you got it to work.

1. 1
2. 2
JoeJ
20
3. 3
4. 4
frob
13
5. 5

• 13
• 18
• 13
• 20
• 13
• ### Forum Statistics

• Total Topics
632194
• Total Posts
3004681

×