Jump to content
  • Advertisement

Archived

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

GekkoCube

my display list class does not draw a cube.

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

here is my entire class, a very simple one that is suppose to draw a box using a display list. i cant even draw a quad with this. please help, its my first time using a display list!
#include <gl/gl.h>
#include <gl/glu.h>

class CBox {
public:

   /////////////////////////////////////////////////////////////////////////////

   CBox()
   {
      box = glGenLists(1);

      glNewList(box,GL_COMPILE);
      glColor3f( 0.8f, 0.0f, 0.0f );

      glBegin(GL_QUADS);							// Start Drawing Quads

			// Bottom Face

			glVertex3f( 1.0f,  1.0f,  1.0f);	// Top Right Of The Texture and Quad

			glVertex3f(-1.0f,  1.0f,  1.0f);	// Top Left Of The Texture and Quad

			glVertex3f(-1.0f, -1.0f,  1.0f);	// Bottom Left Of The Texture and Quad

			glVertex3f( 1.0f, -1.0f,  1.0f);	// Bottom Right Of The Texture and Quad

			// Front Face

			glVertex3f(-1.0f, -1.0f, -1.0f);	// Bottom Left Of The Texture and Quad

			glVertex3f( 1.0f, -1.0f, -1.0f);	// Bottom Right Of The Texture and Quad

			glVertex3f( 1.0f, -1.0f,  1.0f);	// Top Right Of The Texture and Quad

			glVertex3f(-1.0f, -1.0f,  1.0f);	// Top Left Of The Texture and Quad

			// Back Face

			glVertex3f(-1.0f,  1.0f, -1.0f);	// Bottom Right Of The Texture and Quad

			glVertex3f(-1.0f,  1.0f, -1.0f);	// Top Right Of The Texture and Quad

			glVertex3f( 1.0f,  1.0f, -1.0f);	// Top Left Of The Texture and Quad

			glVertex3f( 1.0f,  1.0f, -1.0f);	// Bottom Left Of The Texture and Quad

			// Right face

			glVertex3f( 1.0f, -1.0f, -1.0f);	// Bottom Right Of The Texture and Quad

			glVertex3f( 1.0f,  1.0f, -1.0f);	// Top Right Of The Texture and Quad

			glVertex3f( 1.0f,  1.0f,  1.0f);	// Top Left Of The Texture and Quad

			glVertex3f( 1.0f, -1.0f,  1.0f);	// Bottom Left Of The Texture and Quad

			// Left Face

			glVertex3f(-1.0f, -1.0f, -1.0f);	// Bottom Left Of The Texture and Quad

			glVertex3f(-1.0f, -1.0f,  1.0f);	// Bottom Right Of The Texture and Quad

			glVertex3f(-1.0f,  1.0f,  1.0f);	// Top Right Of The Texture and Quad

			glVertex3f(-1.0f,  1.0f, -1.0f);	// Top Left Of The Texture and Quad


         /*glVertex3f(-1.0f, 1.0f, -1.0f);
         glVertex3f(-1.0f, 1.0f, -1.0f);	// Bottom Left Of The Texture and Quad
			glVertex3f( 1.0f, 1.0f, -1.0f);	// Bottom Right Of The Texture and Quad
			glVertex3f( 1.0f, 1.0f,  1.0f);	// Top Left Of The Texture and Quad*/

		glEnd();

      glEndList();
   }

   /////////////////////////////////////////////////////////////////////////////

   void Draw(float x, float y, float z, float scale)
   {
      //glLoadIdentity();

      glTranslatef(x, y, z);
      glCallList(box);
   }

   /////////////////////////////////////////////////////////////////////////////


private:
   GLuint box;

};

Share this post


Link to post
Share on other sites
Advertisement

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