def draw_arrow(self, color): # Set material glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, color) #glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, color) #glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, [1, 1, 1, 0.0]) #glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 20) # Draw cylinder quad = gluNewQuadric() gluQuadricDrawStyle(quad, GLU_FILL) gluQuadricTexture(quad, True) gluQuadricNormals(quad, GLU_SMOOTH) gluCylinder(quad, self.size / 30, self.size / 30, self.size * 0.8, 20, 20) # Move to the arrowhead position glTranslatef(0, 0, self.size * 0.8) # Draw arrowhead gluQuadricDrawStyle(quad, GLU_FILL) gluQuadricTexture(quad, True) gluQuadricNormals(quad, GLU_SMOOTH) gluCylinder(quad, self.size / 15, 0, self.size * 0.2, 20, 20) # Revert to the original position glTranslatef(0, 0, -self.size * 0.8)
def _C_quadric(self): """ set up self.quadric """ # see PyOpenGL Demo/NeHe/lesson18.py quadric = gluNewQuadric() #e it may be that this object could be shared by all instances, or even more globally -- not sure gluQuadricNormals(quadric, GLU_SMOOTH) # Create Smooth Normals ## gluQuadricTexture(quadric, GL_TRUE) # Create Texture Coords return quadric
def draw(self, from_fixed_frame: bool = True): self.opgl_move_to_pose(from_fixed_frame) self.apply_material() # draw sphere quad = gluNewQuadric() gluQuadricDrawStyle(quad, GLU_FILL) gluQuadricTexture(quad, True) gluQuadricNormals(quad, GLU_SMOOTH) gluSphere(quad, self.radius, 20, 20)
def _C_quadric(self): """ set up self.quadric """ # see PyOpenGL Demo/NeHe/lesson18.py quadric = gluNewQuadric( ) #e it may be that this object could be shared by all instances, or even more globally -- not sure gluQuadricNormals(quadric, GLU_SMOOTH) # Create Smooth Normals ## gluQuadricTexture(quadric, GL_TRUE) # Create Texture Coords return quadric
def draw(self, from_fixed_frame: bool = True): self.opgl_move_to_pose(from_fixed_frame) self.apply_material() # draw parallelepiped quad = gluNewQuadric() gluQuadricDrawStyle(quad, GLU_FILL) gluQuadricTexture(quad, True) gluQuadricNormals(quad, GLU_SMOOTH) glScalef(self.length, self.width, self.height) glutSolidCube(1)
def initialize_draw(self): self.quadric = gluNewQuadric() gluQuadricNormals(self.quadric, GLU_SMOOTH) self.set_specular(True) self.set_bright(False) glLight(GL_LIGHT0, GL_SPECULAR, [0.7, 0.7, 0.7, 1.0]) glLight(GL_LIGHT0, GL_AMBIENT, [0.1, 0.1, 0.1, 1.0]) glLight(GL_LIGHT0, GL_POSITION, [1.0, 1.0, 3.0, 0.0]) glEnable(GL_LIGHT0) glEnable(GL_LIGHTING) glDepthFunc(GL_LESS) glEnable(GL_DEPTH_TEST) glCullFace(GL_BACK) VisBackend.initialize_draw(self) self.tool.initialize_gl()