View Full Version : problem with 2d opengl
06-22-2001, 03:37 AM
I'm attempting to small 2d game in OpenGL just for the hell of it. my code to set up the 2d view is :
This is supposed to make my screen coordinates the same as my screen height and width, (640x480) But if I translate to 10,10,-2 nothing appears on the screen. Can anybody give me some direction on what to do?
Do you have culling enabled? Because you are flipping the image vertically with the projection matrix, face winding is reversed. Try glCullFace(GL_FRONT) OR glFrontFace(GL_CW).
I think your glOrtho parameters are out of order. I am doing the exact same thing as you heres my code:
glViewport(0, 0, w, h);
glMatrixMode( GL_PROJECTION );
glOrtho( 0.0, (float)w, 0.0, (float)h, 0.0f, 10.0f );
glMatrixMode( GL_MODELVIEW );
Second last parameter in my glOrtho call should be -10.0f
06-22-2001, 06:31 AM
Well, (10,10,-2) is out of visualization cube given by
so that coordenates are clipping.
Change z clipping planes to the maximun amd minimun coordenates that you need to be displayed. By example:
06-22-2001, 08:15 AM
I don't have any culling enabled
You're right, I just check the parameters. Will fix it when I get home. thanks.
I wasn't exactly sure about those parameters. thanks for clearing that up for me. that helps out a lot.
thanks for the help guys,
Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.