예제 #1
0
    def paintGL(self):
        """
        This is the draw method.
        Everything is medieval immediate mode, fixed function OpenGL 1.0 calls.
        CCP4MG's opengl Python bindings do not have the new glVertexAttrib, etc. stuff.
        I would advise doing modern OpenGL in a C++ library and calling that stuff from
        here using appropriate Python bindings generator.
        """
        opengl.glLoadIdentity();
        opengl.glScalef(self.scale,self.scale,1.0)
        opengl.glTranslatef(self.origin[0],self.origin[1],self.origin[2]);
        #print "self.origin =", self.origin
        self.quat.Print(); print

        glrotmat = self.quat.getMatrix().to_dp()
        opengl.glMultMatrixd(glrotmat)

        opengl.delcdp(glrotmat)
        opengl.glClear(opengl.GL_COLOR_BUFFER_BIT | opengl.GL_DEPTH_BUFFER_BIT)
        opengl.glColor3f(0.0,0.0,1.0)

        opengl.glBegin(opengl.GL_POINTS)

        for coords in self.coord_list[:5000]:
            opengl.glVertex3f( coords[0], coords[1], coords[2] )

        opengl.glColor3f(0.0,1.0,0.0)
        for coords in self.coord_list[5000:]:
            opengl.glVertex3f( coords[0], coords[1], coords[2] )

        opengl.glEnd()
예제 #2
0
    def paintGL(self):
        """
        This is the draw method.
        Everything is medieval immediate mode, fixed function OpenGL 1.0 calls.
        CCP4MG's opengl Python bindings do not have the new glVertyexAttrib, etc. stuff.
        I would advise doing modern OpenGL in a C++ library and calling that stuff from
        here using appropriate Python bindings generator.
        """
        opengl.glLoadIdentity()
        opengl.glTranslatef(self.origin[0], self.origin[1], self.origin[2])
        print self.origin
        opengl.glClear(opengl.GL_COLOR_BUFFER_BIT | opengl.GL_DEPTH_BUFFER_BIT)
        opengl.glColor3f(0.0, 0.0, 0.0)

        opengl.glBegin(opengl.GL_TRIANGLES)
        opengl.glVertex3f(-10, -10, -1)
        opengl.glVertex3f(10, -10, -1)
        opengl.glVertex3f(0, 10, -1)
        opengl.glEnd()