Displaying Quads w/ a class
hey iam working on a solo project being coded in c++ with the OGL api. Its a tank game. Anyhow Ive got my quad to display outside a class textured and all. But I created a tank class for each individual tank. And I have the same Render code on Tank::Render as i did in the main.cpp. But for some reason it wont display when its called from the class. If anyone could look at the code and tell me whats wrong It would be greatly Appreciated.
The Link to where you can get the current source is :
www.entruder.com/proj/tank/TanksAlots.zip
You're unlikely to get any help on this unless you post the relevant parts of the code.
[edited by - benjamin bunny on February 28, 2004 8:10:26 PM]
[edited by - benjamin bunny on February 28, 2004 8:10:26 PM]
1) use another clear color. try glClearColor( 0.2f, 0.2f, 0.2f, 1.0f ); for example. this makes "debugging" easier.
you will see that your little quad is there and it''s crying for help!
2) enable your face culling again.
3) comment out the glBlend() command
4) you draw your quad clockwise, but in your InitGL() func
you told GL that your front faces are being drawn counter-clockwise. so, if you keep your winding, change the order of your quad vertices.
do:
glVertex3f( -1.0f, 1.0f, 0.0f );
glVertex3f( -1.0f, -1.0f, 0.0f );
glVertex3f( 1.0f, -1.0f, 0.0f );
glVertex3f( 1.0f, 1.0f, 0.0f );
instead of:
glVertex3f( -1.0f, 1.0f, 0.0f );
glVertex3f( 1.0f, 1.0f, 0.0f );
glVertex3f( 1.0f, -1.0f, 0.0f );
glVertex3f( -1.0f, -1.0f, 0.0f );
voila! there''s your textured quad
hope this help.
the byte doctor
you will see that your little quad is there and it''s crying for help!
2) enable your face culling again.
3) comment out the glBlend() command
4) you draw your quad clockwise, but in your InitGL() func
you told GL that your front faces are being drawn counter-clockwise. so, if you keep your winding, change the order of your quad vertices.
do:
glVertex3f( -1.0f, 1.0f, 0.0f );
glVertex3f( -1.0f, -1.0f, 0.0f );
glVertex3f( 1.0f, -1.0f, 0.0f );
glVertex3f( 1.0f, 1.0f, 0.0f );
instead of:
glVertex3f( -1.0f, 1.0f, 0.0f );
glVertex3f( 1.0f, 1.0f, 0.0f );
glVertex3f( 1.0f, -1.0f, 0.0f );
glVertex3f( -1.0f, -1.0f, 0.0f );
voila! there''s your textured quad
hope this help.
the byte doctor
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement