//Do ONCE during init! glClearDepth(1.0f); glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glCullFace(GL_BACK); glEnable(GL_CULL_FACE); glShadeModel(GL_SMOOTH); glEnable( GL_TEXTURE_2D ); quaddisplay=glGenLists(1); //GLuint display list for drawing a quad glNewList(quaddisplay,GL_COMPILE); glBegin(GL_QUADS);{ glTexCoord2f(0.0f,1.0f); glVertex2f(-0.5f, -0.5f); glTexCoord2f(0.0f, 0.0f); glVertex2f(-0.5f ,0.5f); glTexCoord2f(1.0f,0.0f); glVertex2f(0.5f,0.5f); glTexCoord2f(1.0f, 1.0f); glVertex2f(0.5f,-0.5f); }glEnd(); glEndList(); //Load Textures here, save the handles! //Now onto the actual drawing... void GraphicsCore::DrawQuad(Quad* QuadData) //Or something { if (QuadData->visible) { glDepthMask(GL_FALSE); //turn of the Z-Buffer to draw in order (not necessarily what you want to do) glColor4f (QuadData->Color.r(), QuadData->Color.g(), QuadData->Color.b(), QuadData->Color.a()); //Set the color glPushMatrix(); //Save the modelview matrix glLoadIdentity(); glTranslatef(QuadData->Position.x(), QuadData->Position.y(),0.0f); //move it to the right spot glRotatef(QuadData->angle,0.0f,0.0f,1.0f); //rotate it glScalef(QuadData->Size.x(), QuadData->Size.y(),0.0f); //scale glCallList(quaddisplay); //and draw. glPopMatrix(); //restore the old modelview matrix glDepthMask(GL_TRUE); //This also could be unnecessary if drawing a lot of quads, you could seperate it... } }