Ejemplo n.º 1
0
    def drawSelf(self):
        with gl.glPushMatrix(GL.GL_MODELVIEW):
            GL.glLoadIdentity()
            with gl.glPushMatrix(GL.GL_PROJECTION):
                GL.glLoadIdentity()
                with gl.glPushClientAttrib(GL.GL_CLIENT_VERTEX_ARRAY_BIT):
                    GL.glClear(GL.GL_COLOR_BUFFER_BIT)
                    GL.glEnableClientState(GL.GL_COLOR_ARRAY)
                    quad = numpy.array([-1, -1, -1, 1, 1, 1, 1, -1],
                                       dtype='float32')
                    colors = numpy.array([
                        0x48,
                        0x49,
                        0xBA,
                        0xff,
                        0x8a,
                        0xaf,
                        0xff,
                        0xff,
                        0x8a,
                        0xaf,
                        0xff,
                        0xff,
                        0x48,
                        0x49,
                        0xBA,
                        0xff,
                    ],
                                         dtype='uint8')

                    with gl.glPushAttrib(GL.GL_DEPTH_BUFFER_BIT):
                        GL.glDepthMask(False)
                        GL.glVertexPointer(2, GL.GL_FLOAT, 0, quad)
                        GL.glColorPointer(4, GL.GL_UNSIGNED_BYTE, 0, colors)
                        GL.glDrawArrays(GL.GL_QUADS, 0, 4)
Ejemplo n.º 2
0
    def drawSelf(self):
        with gl.glPushMatrix(GL.GL_MODELVIEW):
            GL.glLoadIdentity()
            with gl.glPushMatrix(GL.GL_PROJECTION):
                GL.glLoadIdentity()
                with gl.glPushClientAttrib(GL.GL_CLIENT_VERTEX_ARRAY_BIT):
                    GL.glClear(GL.GL_COLOR_BUFFER_BIT)
                    GL.glEnableClientState(GL.GL_COLOR_ARRAY)
                    quad = numpy.array([-1, -1, -1, 1, 1, 1, 1, -1], dtype='float32')
                    colors = numpy.array([0x48, 0x49, 0xBA, 0xff,
                                          0x8a, 0xaf, 0xff, 0xff,
                                          0x8a, 0xaf, 0xff, 0xff,
                                          0x48, 0x49, 0xBA, 0xff, ], dtype='uint8')

                    with gl.glPushAttrib(GL.GL_DEPTH_BUFFER_BIT):
                        GL.glDepthMask(False)
                        GL.glVertexPointer(2, GL.GL_FLOAT, 0, quad)
                        GL.glColorPointer(4, GL.GL_UNSIGNED_BYTE, 0, colors)
                        GL.glDrawArrays(GL.GL_QUADS, 0, 4)
Ejemplo n.º 3
0
    def drawSelf(self):
        with gl.glPushMatrix(GL.GL_MODELVIEW):
            GL.glLoadIdentity()
            with gl.glPushMatrix(GL.GL_PROJECTION):
                GL.glLoadIdentity()
                GL.glClear(GL.GL_COLOR_BUFFER_BIT)
                GL.glEnableClientState(GL.GL_COLOR_ARRAY)
                quad = numpy.array([-1, -1, -1, 1, 1, 1, 1, -1], dtype='float32')
                colors = numpy.array([0x48, 0x49, 0xBA, 0xff,
                                      0x8a, 0xaf, 0xff, 0xff,
                                      0x8a, 0xaf, 0xff, 0xff,
                                      0x48, 0x49, 0xBA, 0xff, ], dtype='uint8')
                numpy.multiply(colors, self.sceneNode.dayTime, out=colors, casting='unsafe')

                with gl.glPushAttrib(GL.GL_DEPTH_BUFFER_BIT):
                    GL.glDepthMask(False)
                    GL.glVertexPointer(2, GL.GL_FLOAT, 0, quad)
                    GL.glColorPointer(4, GL.GL_UNSIGNED_BYTE, 0, colors)
                    GL.glDrawArrays(GL.GL_QUADS, 0, 4)
                GL.glDisableClientState(GL.GL_COLOR_ARRAY)
Ejemplo n.º 4
0
    def drawSelf(self):

        self._tex.bind()

        with gl.glPushMatrix(GL.GL_MODELVIEW):
            GL.glLoadIdentity()
            yaw, pitch = self.sceneNode.yawPitch
            GL.glTranslatef(0.9, 0.1, 0.0)  # position on lower right corner
            GL.glRotatef(pitch, 1., 0., 0.)  # Tilt upward a bit if the view is pitched
            GL.glRotatef(yaw - 180, 0., 0., 1.)  # adjust to north
            GL.glColor4f(1., 1., 1., 1.)

            with gl.glPushAttrib(GL.GL_ENABLE_BIT):
                GL.glDisable(GL.GL_DEPTH_TEST)
                with gl.glEnableClientState(GL.GL_TEXTURE_COORD_ARRAY):
                    GL.glVertexPointer(2, GL.GL_FLOAT, 0, makeQuad(-.1, -.1, 0.2, 0.2))
                    GL.glTexCoordPointer(2, GL.GL_FLOAT, 0, makeQuad(0, 0, 1, 1))

                    with gl.glEnable(GL.GL_BLEND, GL.GL_TEXTURE_2D):
                        GL.glDrawArrays(GL.GL_QUADS, 0, 4)
Ejemplo n.º 5
0
    def drawSelf(self):

        self._tex.bind()

        with gl.glPushMatrix(GL.GL_MODELVIEW):
            GL.glLoadIdentity()
            yaw, pitch = self.sceneNode.yawPitch
            GL.glTranslatef(0.9, 0.1, 0.0)  # position on lower right corner
            GL.glRotatef(pitch, 1., 0.,
                         0.)  # Tilt upward a bit if the view is pitched
            GL.glRotatef(yaw - 180, 0., 0., 1.)  # adjust to north
            GL.glColor4f(1., 1., 1., 1.)

            with gl.glPushAttrib(GL.GL_ENABLE_BIT):
                GL.glDisable(GL.GL_DEPTH_TEST)
                with gl.glEnableClientState(GL.GL_TEXTURE_COORD_ARRAY):
                    GL.glVertexPointer(2, GL.GL_FLOAT, 0,
                                       makeQuad(-.1, -.1, 0.2, 0.2))
                    GL.glTexCoordPointer(2, GL.GL_FLOAT, 0,
                                         makeQuad(0, 0, 1, 1))

                    with gl.glEnable(GL.GL_BLEND, GL.GL_TEXTURE_2D):
                        GL.glDrawArrays(GL.GL_QUADS, 0, 4)