Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

branhield

Cube....

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

is there anything wrong with this code?? its supposed to make a cube....but when i rotate it around the walls like dissappear and then show up again... glBegin(GL_QUADS); //top glColor3f(0.0, 0.0, 0.4); glVertex3f(1.0, 1.0, -1.0); glVertex3f(-1.0, 1.0, -1.0); glVertex3f(-1.0, 1.0, 1.0); glVertex3f(1.0, 1.0, 1.0); //left glColor3f(0.5, 0.5, 0.5); glVertex3f(-1.0, 1.0, 1.0); glVertex3f(-1.0, 1.0, -1.0); glVertex3f(-1.0, -1.0, -1.0); glVertex3f(-1.0, -1.0, 1.0); //front glColor3f(1.0, 1.0, 1.0); glVertex3f(1.0, 1.0, 1.0); glVertex3f(-1.0, 1.0, 1.0); glVertex3f(-1.0, -1.0, 1.0); glVertex3f(1.0, -1.0, 1.0); //bottom glColor3f(0.0, 0.0, 0.4); glVertex3f(1.0, -1.0, -1.0); glVertex3f(-1.0, -1.0, -1.0); glVertex3f(-1.0, -1.0, 1.0); glVertex3f(1.0, -1.0, 1.0); //back glColor3f(1.0, 1.0, 1.0); glVertex3f(1.0, -1.0, -1.0); glVertex3f(-1.0, -1.0, -1.0); glVertex3f(-1.0, 1.0, -1.0); glVertex3f(1.0, 1.0, -1.0); //right glColor3f(0.5, 0.5, 0.5); glVertex3f(1.0, 1.0, -1.0); glVertex3f(1.0, 1.0, 1.0); glVertex3f(1.0, -1.0, 1.0); glVertex3f(1.0, -1.0, -1.0); glEnd();

Share this post


Link to post
Share on other sites
Advertisement
It might be that the cube is too close to the camera. So you may try moving it in the the negative z direction.

Try putting something like:

glTranslatef(0.0f, 0.0f, -5.0f);

before drawing the cube.




A CRPG in development...

Need help? Well, go FAQ yourself.



Edited by - Nazrix on February 17, 2002 6:46:00 PM

Share this post


Link to post
Share on other sites
also if all your vertex calls you didnt put the f after the numbers eg 0.0f, this indicates to the compiler is floating point

Share this post


Link to post
Share on other sites
It could be to do with backface culling. Try putting in a "glDisable(GL_CULL_FACE);" and see if that solves it. If so, make sure you specify your vertices in the correct order (anti-clockwise = facing towards you, clockwise = facing away).

Alimonster

There are no stupid questions, but there are a lot of inquisitive idiots.

Share this post


Link to post
Share on other sites

  • 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!