• Advertisement
Sign in to follow this  

gluOrtho2D() and textures

This topic is 4038 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

I want to use gluOrtho2D since I'm making a 2D game. When I just draw the texture without gluOrtho2D it draws in the middle of the screen. I want it to draw in the top left corner, but when I put gluOrtho2D() before the drawing code nothing shows up. I want to use gluOrtho2D so the texture will be drawn in the top left corner instead of in the middle of the screen. I know I could just change the coordinates, but I'd rather have (0,0) be in the top left corner instead of somewhere in the middle of the screen. I've searched for this but I havn't found anything with both gluOrtho2D and textures. Can anyone help me out? Thank you for your time.

Share this post


Link to post
Share on other sites
Advertisement
I think you'll find that your polygon is upside down and hence backwards, so its getting back face culled. It turns out that with OpenGL and Ortho2D() the bottom left corner of the screen is (0,0), with y going up the screen, and x to the right. As such if you've planed your polygon with top-left as the origin your winding order is probably backwards and hence pointing away from the screen at a guess.

Share this post


Link to post
Share on other sites
There could be many things going wrong, but you should certainly be able to draw something textured with gluOrtho2D.

Take careful note of the parameters for that function. And post some code if you are still stuck.

Share this post


Link to post
Share on other sites
Try calling glDisable(GL_CULL_FACE) which should disable polygon culling. If that doesn't work, then check your front/rear clipping planes.

Share this post


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

  • Advertisement