Exemplo n.º 1
0
    def __init__(self, points, complex = None, values = None, subcomplex = None, point_size = 3.):
        self.display_list = None
        PyGLWidget.__init__(self)

        #glEnable( GL_BLEND )
        #glEnable( GL_LINE_SMOOTH )
        #glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)

        self.point_size = point_size
        self.points = points
        if complex:
            self.complex = [s for s in complex]
        else:
            # Create vertex simplices if no complex provided
            self.complex = [Simplex([i]) for i in xrange(len(self.points))]

        if subcomplex:
            self.subcomplex = subcomplex
        else:
            self.subcomplex = []

        self.values = values
        if not values:
            self.values = [0]*len(self.points)
        self.maxval, self.minval = max(self.values), min(self.values)

        center, radius = self.center_radius()
        self.set_radius(radius)
        self.set_center(center)

        self.make_display_list()
Exemplo n.º 2
0
 def paintGL(self):
     PyGLWidget.paintGL(self)
     glBegin(GL_TRIANGLES)
     glColor3f(1, 0, 0)
     glVertex3f(0, 0, 0)
     glColor3f(0, 1, 0)
     glVertex3f(0, 1, 0)
     glColor3f(0, 0, 1)
     glVertex3f(1, 1, 0)
     glEnd()
Exemplo n.º 3
0
 def __init__(self, parent = None):
     PyGLWidget.__init__(self,parent)
     self.animTimer = QTimer()
     self.animTimer.timeout.connect(self.animate)
     self.renderInfo = None
     self.sim= None
     self.modfile = None
     self.record = False
     self.set_radius(32)
     self.frameNo = 0
Exemplo n.º 4
0
 def paintGL(self):
     PyGLWidget.paintGL(self)
     glBegin(GL_TRIANGLES)
     glColor3f(1,0,0)
     glVertex3f(0,0,0)
     glColor3f(0,1,0)
     glVertex3f(0,1,0)
     glColor3f(0,0,1)
     glVertex3f(1,1,0)
     glEnd()
Exemplo n.º 5
0
 def paintGL(self):
     PyGLWidget.paintGL(self)
     # glBegin(GL_TRIANGLES)
     # glColor3f(1,0,0)
     # glVertex3f(0,0,0)
     # glColor3f(0,1,0)
     # glVertex3f(0,1,0)
     # glColor3f(0,0,1)
     # glVertex3f(1,1,0)
     # glEnd()
     # Read the model
     tank_model = model3d.Model3D()
     tank_model.read_obj('mytank.obj')
     tank_model.draw_quick()
Exemplo n.º 6
0
    def paintGL(self):
        PyGLWidget.paintGL(self)
        glClearColor(0.5,0.5,0.5,0.0)
        glClear(GL_COLOR_BUFFER_BIT)
        glMatrixMode(GL_MODELVIEW)
        glPushMatrix()
        #s = self.renderInfo.scale
        #glScalef(s,s,s)
        if self.sim:
            for r in self.sim.renderers:
                if r != None:
                    r.render_gl(self.selectedName)

        glPopMatrix()
Exemplo n.º 7
0
    def paintGL(self):
        PyGLWidget.paintGL(self)
        glClearColor(0.5, 0.5, 0.5, 0.0)
        glClear(GL_COLOR_BUFFER_BIT)
        glMatrixMode(GL_MODELVIEW)
        glPushMatrix()
        #s = self.renderInfo.scale
        #glScalef(s,s,s)

        # Draw a grid in xy plane
        glDisable(GL_LIGHTING)
        glColor3f(1.0, 1.0, 1.0)
        glEnable(GL_LINE_SMOOTH)
        glLineWidth(1.0)
        glBegin(GL_LINES)
        for i in range(5):
            glVertex(-50, (i - 2) *
                     25)  #kk: increased values by 2.5; change actual grid size
            glVertex(50, (i - 2) * 25)
            glVertex((i - 2) * 25, -50)
            glVertex((i - 2) * 25, 50)
        glEnd()

        # Draw x,y,z axes
        glDisable(GL_DEPTH_TEST)
        glBegin(GL_LINES)
        glColor3f(1.0, 0.0, 0.0)
        glVertex(0, 0, 0)
        glVertex(5, 0, 0)
        glColor3f(0.0, 1.0, 0.0)
        glVertex(0, 0, 0)
        glVertex(0, 5, 0)
        glColor3f(0.0, 0.0, 1.0)
        glVertex(0, 0, 0)
        glVertex(0, 0, 5)
        glEnd()
        glEnable(GL_DEPTH_TEST)
        glEnable(GL_LIGHTING)

        # Draw model
        if self.sim:
            for r in self.sim.renderers:
                if r != None:
                    r.render_gl(self.selectedName)
        glPopMatrix()
Exemplo n.º 8
0
    def __init__(self, parent = None):
        PyGLWidget.__init__(self,parent)
        self.animTimer = QTimer()
        self.animTimer.timeout.connect(self.animate)
        self.animTimer.start(0)
        self.renderInfo = None
        self.sim = None
        self.run = False
        self.frameNo = 0
        self.loadingFromPickle = False
        self.clPlatformNum=0
        self.clDeviceNum=0

        # Initial view setup
        self.set_radius(32)
        self.rotate([0,0,1],-45)
        self.translate([0,0,20])
        self.rotate([1,0,0],-45)
Exemplo n.º 9
0
    def __init__(self, parent = None):
        PyGLWidget.__init__(self,parent)
        self.animTimer = QTimer()
        self.animTimer.timeout.connect(self.animate)
        self.animTimer.start(0)
        self.renderInfo = None
        self.sim = None
        self.run = False
        self.frameNo = 0
        self.loadingFromPickle = False
        self.clPlatformNum=0
        self.clDeviceNum=0

        # Initial view setup
        self.set_radius(32)
        self.rotate([0,0,1],-45)
        self.translate([0,0,20])
        self.rotate([1,0,0],-45)
Exemplo n.º 10
0
    def paintGL(self):
        PyGLWidget.paintGL(self)
        glClearColor(0.5,0.5,0.5,0.0)
        glClear(GL_COLOR_BUFFER_BIT)
        glMatrixMode(GL_MODELVIEW)
        glPushMatrix()
        #s = self.renderInfo.scale
        #glScalef(s,s,s)

        # Draw a grid in xy plane
        glDisable(GL_LIGHTING)
        glColor3f(1.0, 1.0, 1.0)
        glEnable(GL_LINE_SMOOTH)
        glLineWidth(1.0)
        glBegin(GL_LINES)
        for i in range(5):
            glVertex(-20, (i-2)*10)
            glVertex(20, (i-2)*10)
            glVertex((i-2)*10, -20)
            glVertex((i-2)*10, 20)
        glEnd()

        # Draw x,y,z axes
        glDisable(GL_DEPTH_TEST)
        glBegin(GL_LINES)
        glColor3f(1.0,0.0,0.0)
        glVertex(0,0,0)
        glVertex(5,0,0)
        glColor3f(0.0,1.0,0.0)
        glVertex(0,0,0)
        glVertex(0,5,0)
        glColor3f(0.0,0.0,1.0)
        glVertex(0,0,0)
        glVertex(0,0,5)
        glEnd()
        glEnable(GL_DEPTH_TEST)
        glEnable(GL_LIGHTING)

        # Draw model
        if self.sim:
            for r in self.sim.renderers:
                if r != None:
                    r.render_gl(self.selectedName)
        glPopMatrix()
Exemplo n.º 11
0
    def __init__(self,
                 points,
                 complex=None,
                 values=None,
                 subcomplex=None,
                 point_size=3.):
        self.display_list = None
        PyGLWidget.__init__(self)

        #glEnable( GL_BLEND )
        #glEnable( GL_LINE_SMOOTH )
        #glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)

        self.point_size = point_size
        self.points = points
        if complex:
            self.complex = [s for s in complex]
        else:
            # Create vertex simplices if no complex provided
            self.complex = [Simplex([i]) for i in xrange(len(self.points))]

        if subcomplex:
            self.subcomplex = subcomplex
        else:
            self.subcomplex = []

        self.values = values
        if not values:
            self.values = [0] * len(self.points)
        self.maxval, self.minval = max(self.values), min(self.values)

        center, radius = self.center_radius()
        self.set_radius(radius)
        self.set_center(center)

        self.make_display_list()
Exemplo n.º 12
0
    def paintGL(self):
        PyGLWidget.paintGL(self)
#        self.lights()
        scale = 8
        glColor3f(1,0,0)
        #glEnable(GL_BLEND)
        #glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
        #gluSphere(gluNewQuadric(),0.95/scale, 20, 20)
        glColor(0,0,1)
        glPointSize(3)
#        glDisable(GL_LIGHTING)
        glBegin(GL_POINTS)
        #glPoint(1,1,1)
        for location in self.location:
        	glVertex3f(location[0]/scale,location[1]/scale,location[2]/scale)
        glEnd()

        for line in self.lines:
            glColor(0, 1, 0)
            glLineWidth(4)
            glBegin(GL_LINES)
            glVertex3f(line[0][0]/scale,line[0][1]/scale,line[0][2]/scale)
            glVertex3f(line[1][0]/scale,line[1][1]/scale,line[1][2]/scale)
            glEnd()
Exemplo n.º 13
0
 def paintGL(self):
     PyGLWidget.paintGL(self)
     if self.display_list:
         glCallList(self.display_list)
Exemplo n.º 14
0
 def paintGL(self):
     PyGLWidget.paintGL(self)
     if self.display_list:
         glCallList(self.display_list)
    def paintGL(self):
        PyGLWidget.paintGL(self)
	self.render()