def draw_teapot(): if fill.value: gl.glEnable(gl.GL_LIGHTING) gl.glEnable(gl.GL_DEPTH_TEST) gl.glColor3f(color[0], color[1], color[2]) gl.glPolygonOffset(1, 1) gl.glEnable(gl.GL_POLYGON_OFFSET_FILL) if shape.value == 0: glut.glutSolidCube(1) elif shape.value == 1: glut.glutSolidTorus(0.25, 0.50, 32, 32) else: glut.glutSolidTeapot(.75) gl.glDisable(gl.GL_LIGHTING) gl.glDisable(gl.GL_POLYGON_OFFSET_FILL) gl.glEnable(gl.GL_LINE_SMOOTH) gl.glEnable(gl.GL_BLEND) gl.glDepthMask(gl.GL_FALSE) gl.glColor4f(0, 0, 0, .5) if shape.value == 0: glut.glutWireCube(1) elif shape.value == 1: glut.glutWireTorus(0.25, 0.50, 32, 32) else: glut.glutWireTeapot(.75) gl.glDepthMask(gl.GL_TRUE)
def draw_teapot(): if fill.value: gl.glEnable (gl.GL_LIGHTING) gl.glEnable (gl.GL_DEPTH_TEST) gl.glColor3f(color[0],color[1],color[2]) gl.glPolygonOffset (1, 1) gl.glEnable (gl.GL_POLYGON_OFFSET_FILL) if shape.value == 0: glut.glutSolidCube(1) elif shape.value == 1: glut.glutSolidTorus(0.25, 0.50, 32, 32) else: glut.glutSolidTeapot(.75) gl.glDisable (gl.GL_LIGHTING) gl.glDisable (gl.GL_POLYGON_OFFSET_FILL) gl.glEnable (gl.GL_LINE_SMOOTH) gl.glEnable (gl.GL_BLEND) gl.glDepthMask (gl.GL_FALSE) gl.glColor4f(0,0,0,.5) if shape.value == 0: glut.glutWireCube(1) elif shape.value == 1: glut.glutWireTorus(0.25, 0.50, 32, 32) else: glut.glutWireTeapot(.75) gl.glDepthMask (gl.GL_TRUE)
def display() : global camera gl.glClear(gl.GL_COLOR_BUFFER_BIT) gl.glPushMatrix() gl.glRotatef(camera, 1.0, 0.0, 0.0) gl.glColor3f(0.3, 0.7, 0.25) # toroide de cor verde glut.glutWireTorus(0.5, 1.0, 20, 50) # criacao de um toroide: # 0.5 raio interno # 1.0 raio externo # 20 lados para cada secao radial # 50 divisoes radiais para o toroide gl.glPopMatrix() glut.glutSwapBuffers()