Jump to content
  • Advertisement
Sign in to follow this  
Eldritch

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.

If you intended to correct an error in the post then please contact us.

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);
glLoadIdentity();
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 this post


Link to post
Share on other sites
Advertisement
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 this post


Link to post
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 this post


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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!