Exemplo n.º 1
1
 def call(self):
     assert self._list
     GL.glCallLists(self._list)
Exemplo n.º 2
0
 def drawtext(self, text):
     gl.glBindTexture(gl.GL_TEXTURE_2D, self.texid)
     gl.glPushMatrix()
     gl.glListBase(self.base + 1)
     gl.glCallLists([ord(c) for c in text])
     gl.glPopMatrix()
     gl.glBindTexture(gl.GL_TEXTURE_2D, 0)
Exemplo n.º 3
0
 def printGL(self, mystr):
     # // If THere's No Text Do Nothing
     GL.glPushMatrix(GL.GL_LIST_BIT)
     # // Pushes The Display List Bits
     try:
         GL.glListBase(self.base)
         # // Sets The Base Character to 32
         GL.glCallLists(mystr)  # // Draws The Display List Text
     finally:
         GL.glPopMatrix()
Exemplo n.º 4
0
 def draw(self):
     self.angle = -atan2(-self.xvel, -self.yvel)/3.141573*180
     GL.glPushMatrix()
     GL.glTranslatef(self.x, self.y, 0.0)
     GL.glRotatef(self.angle, 0, 0, 1)
     GL.glScalef(8*self.scale, -8*self.scale, 8)
     GL.glBindTexture(GL.GL_TEXTURE_2D, self.image)
     GL.glColor3f(1.0, 1.0, 1.0)
     GL.glCallLists([display.qid2])
     GL.glPopMatrix()
Exemplo n.º 5
0
 def callChildren(self):
     if len(self.children):
         lists = [node.getList()
                  for node in self.children
                  if node.sceneNode.visible]
         if len(lists):
             lists = numpy.hstack(tuple(lists))
             try:
                 GL.glCallLists(lists)
             except GL.error as e:
                 log.exception("Error calling child lists: %s", e)
                 raise
Exemplo n.º 6
0
 def drawChildren(self):
     if len(self.children):
         lists = [node.getList()
                  for node in self.children
                  if node.sceneNode.visible]
         if len(lists):
             lists = numpy.hstack(tuple(lists))
             try:
                 GL.glCallLists(lists)
             except GL.error as e:
                 log.exception("Error calling child lists: %s", e)
                 raise
Exemplo n.º 7
0
 def draw(self):
     GL.glPushMatrix()
     GL.glTranslatef(self.x, self.y, 0.0)
     #self.angle = -atan2(cos(-self.xvel),-self.yvel)/3.141573*180
     #GL.glRotatef(self.angle,0,0,1)
     #GL.glScalef(8,-8,8)
     dectime = self.totalmoves/self.startmoves
     agemod = 0.6+(dectime)*0.4
     GL.glScalef(self.scale*agemod*8,self.scale*agemod*-8,1)
     GL.glBindTexture(GL.GL_TEXTURE_2D, self.image)
     GL.glColor4f(self.colour[0],self.colour[1],self.colour[2],(dectime*0.9))
     GL.glCallLists([display.qid])
     GL.glPopMatrix()
Exemplo n.º 8
0
def draw(cx,cy):
    global toupdate,x2,y2
    if len(toupdate) > 0:
        for i in toupdate:
            resettex(i[0], i[1])
        toupdate = []



    GL.glColor4f(1.0, 1.0, 1.0,1.0)
    GL.glCallLists([listid])
    #GL.glTranslatef(0,0,-1000)
    '''cx = int(display.camx/tilesize)
Exemplo n.º 9
0
def on_display( ):
    global texid
    gl.glClearColor(1,1,1,1)
    gl.glClear(gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT)
    gl.glBindTexture( gl.GL_TEXTURE_2D, texid )
    gl.glColor(0,0,0,1)
    gl.glPushMatrix( )
    gl.glTranslate( 10, 100, 0 )
    gl.glPushMatrix( )
    gl.glListBase( base+1 )
    gl.glCallLists( [ord(c) for c in text] )
    gl.glPopMatrix( )
    gl.glPopMatrix( )
    glut.glutSwapBuffers( )
Exemplo n.º 10
0
def on_display():
    global texid
    gl.glClearColor(1, 1, 1, 1)
    gl.glClear(gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT)
    gl.glBindTexture(gl.GL_TEXTURE_2D, texid)
    gl.glColor(0, 0, 0, 1)
    gl.glPushMatrix()
    gl.glTranslate(10, 100, 0)
    gl.glPushMatrix()
    gl.glListBase(base + 1)
    gl.glCallLists([ord(c) for c in text])
    gl.glPopMatrix()
    gl.glPopMatrix()
    glut.glutSwapBuffers()
Exemplo n.º 11
0
    def glPrint (self, x, y, string):
        """
        Much like Nehe's glPrint function, but modified to work
        with freetype fonts.
        expects to be in orthogonal projection and model view.
        """

        # //Here is some code to split the text that we have been
        # //given into a set of lines.  
        # //This could be made much neater by using
        # //a regular expression library such as the one avliable from
        # //boost.org (I've only done it out by hand to avoid complicating
        # //this tutorial with unnecessary library dependencies).
        # //Note: python string object has convenience method for this :)
        lines = string.split ("\n")

        gl.glPushAttrib(gl.GL_LIST_BIT | gl.GL_ENABLE_BIT)
        gl.glEnable(gl.GL_TEXTURE_2D)
        gl.glEnable(gl.GL_BLEND)
        gl.glBlendFunc(gl.GL_SRC_ALPHA, gl.GL_ONE_MINUS_SRC_ALPHA)

        gl.glListBase(self.listBase)

        # This is where the text display actually happens
        for i in xrange (len (lines)):
            line = lines [i]

            gl.glPushMatrix ()
            gl.glTranslatef (x, y-self.lineHeight*i, 0)

            # //  The commented out raster position stuff can be useful if you need to
            # //  know the length of the text that you are creating.
            # //  If you decide to use it make sure to also uncomment the glBitmap command
            # //  in makeDList().
            # //    glRasterPos2f(0,0);
            gl.glCallLists (line)
            # //    rpos = glGetFloatv (GL_CURRENT_RASTER_POSITION)
            # //    float len=x-rpos[0];
            gl.glPopMatrix()

        gl.glPopAttrib()
Exemplo n.º 12
0
 def call(self):
     assert self._list is not None
     GL.glCallLists(self._list)
Exemplo n.º 13
0
 def call(self, drawFunc=None):
     self.compile(drawFunc)
     GL.glCallLists(self._list)
Exemplo n.º 14
0
 def call(self, drawFunc=None):
     self.makeList(drawFunc)
     GL.glCallLists(self._list)
Exemplo n.º 15
0
 def call(self, drawFunc=None):
     self.compile(drawFunc)
     GL.glCallLists(self._list)
Exemplo n.º 16
0
 def printString(self, text):
     GL.glPushAttrib(GL.GL_LIST_BIT)
     GL.glListBase(self.fontOffset)
     GL.glCallLists(text)
     GL.glPopAttrib()
Exemplo n.º 17
0
 def call(self, drawFunc=None):
     self.makeList(drawFunc)
     GL.glCallLists(self._list)
Exemplo n.º 18
0
    def printString(self, text):
	GL.glPushAttrib(GL.GL_LIST_BIT)
	GL.glListBase(self.fontOffset)
	GL.glCallLists(text)
	GL.glPopAttrib()