Beispiel #1
0
    def draw(self):
        """
        Must be drawn whene TEXTURE1 is active
        and TEXTURE_2D is enabled
        """
        intf.glActiveTexture(intf.GL_TEXTURE1)
        intf.glBindTexture(intf.GL_TEXTURE_2D, self.texture.name)
        intf.glPushMatrix()

        intf.glTranslatef(self.pos[0], self.pos[1], self.pos[2])
        intf.glRotatef(self.rotate[0], 1, 0, 0)
        intf.glRotatef(self.rotate[2], 0, 0, 1)
        intf.glCallList(self.list)
        # intf.glutSolidSphere(1,10,10)
        intf.glPopMatrix()
Beispiel #2
0
	def newGLTexture(self):
		self.name = intf.glGenTextures(1)

		intf.glActiveTexture (intf.GL_TEXTURE1)
		
		intf.glBindTexture(intf.GL_TEXTURE_2D,self.name)
		
		intf.glTexParameteri(intf.GL_TEXTURE_2D, intf.GL_TEXTURE_WRAP_S, intf.GL_REPEAT)
		intf.glTexParameteri(intf.GL_TEXTURE_2D, intf.GL_TEXTURE_WRAP_T, intf.GL_REPEAT)
		intf.glTexParameteri(intf.GL_TEXTURE_2D, intf.GL_TEXTURE_MAG_FILTER, intf.GL_NEAREST)
		intf.glTexParameteri(intf.GL_TEXTURE_2D, intf.GL_TEXTURE_MIN_FILTER, intf.GL_NEAREST)
		intf.glTexImage2D(intf.GL_TEXTURE_2D,
				  0,self.internFormat,
				  self.size[0],self.size[1],0,
				  self.texFormat,intf.GL_UNSIGNED_BYTE,self.texels)
		if pyCaveOptions['debug']:
		    print 'TGALOADER: Stored 2D texture in OpenGL with name', self.name
Beispiel #3
0
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)
Beispiel #4
0
    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)