def display_sphere(self): GL.glPointSize(1); GL.glLineWidth(0.5); GL.glMaterialfv(GL.GL_FRONT, GL.GL_DIFFUSE, [1, 1, 1, 0.1]) GLUT.glutWireSphere(0.97, 20, 20) GL.glMaterialfv(GL.GL_FRONT, GL.GL_DIFFUSE, [1, 1, 1, 0.5]) GLUT.glutSolidSphere(0.98, 20, 20)
def paintGL(self, p0=0, p1=None, drawOpts=DRAWOPT_DEFAULT): if not self.visible: return is_click = (p1 is not None) if p1 is None: p1 = len(self) if p1 <= p0: return # draw nothing GL.glShadeModel(GL.GL_SMOOTH) GL.glPushMatrix() GL.glMultMatrixf(self.transform) GL.glColor4f(*self.colour) GL.glDisable(GL.GL_BLEND) GL.glEnable(GL.GL_DEPTH_TEST) primType = self.primitiveType.lower() if primType == 'sphere': radius = self.attrs.get('radius', 100.) slices = self.attrs.get('slices', 10) stacks = self.attrs.get('stacks', 10) if self.attrs.get('wire',None): GLUT.glutWireSphere(radius, slices, stacks) else: GLUT.glutSolidSphere(radius, slices, stacks) elif primType == 'cube': size = self.attrs.get('size', 100.) if self.attrs.get('wire',None): GLUT.glutWireCube(size) else: GLUT.glutSolidCube(size) GL.glPopMatrix()
def display(): global camera gl.glClear(gl.GL_COLOR_BUFFER_BIT) gl.glPushMatrix() gl.glRotatef(camera, 1.0, 0.0, 0.0) gl.glColor3f(1.0, 1.0, 0.0) # Essa cor tem que mudar ! glut.glutWireSphere( 1.0, 20, 16) # Essa forma geometrica tem que mudar (nao pode ser uma esfera) ! gl.glPopMatrix() glut.glutSwapBuffers()
def paintGL(self): self.loadScene() glut.glutWireSphere(2, 13, 13)
def draw_shape(self): # draw sphere # glut.glutSolidSphere(self.radius, 16, 16) glut.glutWireSphere(self.radius, 16, 16)