def drawString(text, scale=1.0, translate=(0,0), font=intf.GLUT_STROKE_ROMAN):##font=intf.GLUT_BITMAP_TIMES_ROMAN_24 #disable texturing intf.glActiveTexture (intf.GL_TEXTURE1) intf.glDisable(intf.GL_TEXTURE_2D) intf.glActiveTexture (intf.GL_TEXTURE0) intf.glDisable(intf.GL_TEXTURE_2D) intf.glMatrixMode(intf.GL_MODELVIEW) intf.glPushMatrix() intf.glTranslatef(-1,0,0) intf.glTranslatef(translate[0],translate[1],0) intf.glScalef(0.0006,0.0006,0) intf.glScalef(scale,scale,0) for c in text: intf.glutStrokeCharacter(font,ord(c)) intf.glPopMatrix() #reenable texturing intf.glEnable(intf.GL_TEXTURE_2D) intf.glActiveTexture (intf.GL_TEXTURE1) intf.glEnable(intf.GL_TEXTURE_2D)
def drawGeometry(self): """ Send geometry to opengl """ intf.glActiveTexture (intf.GL_TEXTURE0) #UNTEXTURED intf.glActiveTexture (intf.GL_TEXTURE1) intf.glDisable (intf.GL_TEXTURE_2D) self.gameplay.tunnel.drawObstacles() self.gameplay.tunnel.draw () intf.glEnable (intf.GL_TEXTURE_2D) #TEXTURED self.gameplay.ship.draw () #SPRITES intf.glDisable (intf.GL_DEPTH_TEST) self.gameplay.ship.drawSmoke () intf.glEnable (intf.GL_DEPTH_TEST) intf.glActiveTexture (intf.GL_TEXTURE0) intf.glEnable(intf.GL_TEXTURE_2D)
def draw(self): intf.glMaterialfv(intf.GL_FRONT,intf.GL_DIFFUSE,(.9,.98,1,1)) intf.glMaterialfv(intf.GL_BACK,intf.GL_DIFFUSE,(0,0,0,1)) intf.glEnable(intf.GL_NORMALIZE) #TODO: This is slow, fix... intf.glPushMatrix() intf.glTranslatef(0,0,self.trans) intf.glCallList(self.list) intf.glPopMatrix() intf.glDisable(intf.GL_NORMALIZE) intf.glMaterialfv(intf.GL_FRONT_AND_BACK,intf.GL_DIFFUSE,(1,1,1,1))