I have to translate the 'camera' backwards to get the most recently drawn polygon to show on top of the last one:
I just want to draw 2d shapes to the screen, using gltranslate makes the gl-coord to pixel co-ord calculations change
the code above is not using glortho
does glortho fix this problem?
p.s. is there another way of beggining a new quad other than using glbegin?
I just want to draw 2d shapes to the screen, using gltranslate makes the gl-coord to pixel co-ord calculations change
GLGraphics 640 , 480 glClearColor(0.0, 0.0, 0.0, 0.0) glClearDepth 1.0 glDepthFunc(GL_LESS) glEnable(GL_DEPTH_TEST) glFrontFace(GL_CW) glShadeModel(GL_SMOOTH) glViewport(0,0,640,480) glMatrixMode(GL_PROJECTION) glLoadIdentity() gluPerspective(45.0,Float(640)/Float(480),1.0,100.0) glMatrixMode(GL_MODELVIEW) While Not AppTerminate() glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)' // Clear The Screen And The Depth Buffer glLoadIdentity glTranslatef( 0 , 0 , - 6.0) glBegin(GL_QUADS) glcolor3f(1 , 1 , 1) glvertex3f( - 1 , 1 , 0) glcolor3f(0.5 , 0.5 , 0.5) glVertex3f( -1,-1, 0.0)' // Top glVertex3f( 1 , - 1.0 , 0.0) glcolor3f(0.25 , 0.25 , 0.25) glVertex3f( 1.0,1.0, 0.0)' // Bottom Right glend glTranslatef( 0 , 0 , .1) glBegin(GL_QUADS) glcolor3f(0.25 , 0.25 , 0.25) glvertex3f( - .5 , .5 , 0) glcolor3f(0.5 , 0.5 , 0.5) glVertex3f( -.5,-.5, 0.0)' // Top glVertex3f( .5 , - 0.5 , 0.0) glcolor3f(1 , 1 , 1) glVertex3f( 0.5,0.5, 0.0)' // Bottom Right glEnd glColor3f(1.0 , 1.0 , 1.0) GLDrawText ("hello" , 0 , 0) 'Framecounter-------------------------------------------- Framecounter_counter=Framecounter_counter+1 If Framecounter_time=0 Then Framecounter_time=MilliSecs() If Framecounter_time+1001 <MilliSecs() Then Framecounter_framerate=Framecounter_counter Framecounter_counter=0 Framecounter_time=MilliSecs() EndIf GLDrawText("FPS : "+Framecounter_framerate,640-(8*12),480-16-8) Flip false Wend
the code above is not using glortho
does glortho fix this problem?
p.s. is there another way of beggining a new quad other than using glbegin?