def draw_path_with_traveler(a_path): """ draws a box where the position of the traveler is on the path. """ #TODO: speed this up. take out the scale as well. draw_path(a_path) # Get where the traveler is, and draw something there. x, y, z = a_path.Where() ##glPushAttrib(GL_ALL_ATTRIB_BITS) ##glMatrixMode(GL_MODELVIEW) ##glLoadIdentity() ##glScale(0.2, 0.2, 0.2) glTranslatef(x, y, z) # now draw a teapot there. glutSolidTeapot(0.1) glTranslatef(-x, -y, -z)
def draw_path_with_traveler(a_path): """ draws a box where the position of the traveler is on the path. """ #TODO: speed this up. take out the scale as well. draw_path(a_path) # Get where the traveler is, and draw something there. x,y,z = a_path.Where() ##glPushAttrib(GL_ALL_ATTRIB_BITS) ##glMatrixMode(GL_MODELVIEW) ##glLoadIdentity() ##glScale(0.2, 0.2, 0.2) glTranslatef(x,y,z) # now draw a teapot there. glutSolidTeapot(0.1) glTranslatef(-x,-y,-z)
def __init__(self, size=1.0): self.list = glGenLists(1) glNewList(self.list, GL_COMPILE) try: glutSolidTeapot(size) except: print "Teapot loading failed! Upgrade your OpenGL!" glEndList()
def handle_draw( self ): """draw a teapot """ #print "handle draw 0" glMaterialfv( GL_FRONT, GL_SPECULAR, self.specular ) glMaterialfv( GL_FRONT, GL_SHININESS, self.shininess ) glMaterialfv( GL_FRONT, GL_DIFFUSE, self.diffuse ) if self.teapot: glutSolidTeapot( 10.0 ) else: glutSolidSphere( 10.0, 12, 12 )
def render( self, visible=1, # can skip normals and textures if not lit=1, # can skip normals if not textured=1, # can skip textureCoordinates if not transparent=0, # XXX should sort triangle geometry... mode=None, # the renderpass object for which we compile ): """Render the Teapot""" glFrontFace(GL_CW) try: if not self.solid: glutWireTeapot(self.size) else: glutSolidTeapot(self.size) finally: glFrontFace(GL_CCW)
def render ( self, visible = 1, # can skip normals and textures if not lit = 1, # can skip normals if not textured = 1, # can skip textureCoordinates if not transparent = 0, # XXX should sort triangle geometry... mode = None, # the renderpass object for which we compile ): """Render the Teapot""" glFrontFace(GL_CW) try: if not self.solid: glutWireTeapot( self.size ) else: glutSolidTeapot( self.size ) finally: glFrontFace(GL_CCW)
def __init__(self,size=1.0): self.list = glGenLists(1) glNewList(self.list, GL_COMPILE) glutSolidTeapot(size) glEndList()