def render(self): """ Render the primitives of the shape. """ glPushMatrix() glTranslatef(self.x,self.y,self.z) glRotatef(self.rot[0],1,0,0) glRotatef(self.rot[1],0,1,0) glRotatef(self.rot[2],0,0,1) #glTranslatef(-self.x,-self.y,-self.z) glColor3f(self.colors[0],self.colors[1],self.colors[2]) glMaterialfv(GL_FRONT,GL_DIFFUSE,glcommon.iter_to_glfloats(self.diffuse)) glMaterialfv(GL_FRONT,GL_AMBIENT,glcommon.iter_to_glfloats(self.ambient)) glMaterialfv(GL_FRONT,GL_SPECULAR,glcommon.iter_to_glfloats(self.specular)) if self.wireframe: glPolygonMode( GL_FRONT_AND_BACK, GL_LINE ); for prim in self.primitives: glPushMatrix() glRotatef(prim.rot[0],1,0,0) glRotatef(prim.rot[1],0,1,0) glRotatef(prim.rot[2],0,0,1) pyglet.graphics.draw(len(prim.verts),prim.primitive,('v3f',prim._get_verts())) glPopMatrix() for sub in self.sub_shapes: sub.render() if self.wireframe: glPolygonMode( GL_FRONT_AND_BACK, GL_FILL ); glPopMatrix()
def render(self): glLightModelfv(GL_LIGHT_MODEL_AMBIENT, glcommon.iter_to_glfloats(self.color))
def render(self): glLightfv(self.light_index,GL_POSITION,glcommon.iter_to_glfloats(self.position))