Original Post
Can anybody spot a problem with the following code:
* The quad is displayed correctly on the scene
* The variable thetaQuad is definitely a float
* The Python interpreter reports no errors
import sys
from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
thetaQuad = 0.1
def renderScene():
global thetaQuad
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT )
glLoadIdentity()
glRotatef( thetaQuad, 0.0, 1.0, 0.0 )
glBegin( GL_QUADS )
glVertex3f( -0.5, -0.5, 0.0 )
glVertex3f( -0.5, 0.5, 0.0 )
glVertex3f( 0.5, 0.5, 0.0 )
glVertex3f( 0.5, -0.5, 0.0 )
glEnd()
glutSwapBuffers()
thetaQuad += 0.2
def initScene():
glClearColor( 0.3, 0.3, 0.3, 1.0 )
glShadeModel( GL_SMOOTH )
def idleScene():
pass
def main():
glutInit( sys.argv )
glutInitDisplayMode( GLUT_RGBA | GLUT_DOUBLE )
glutInitWindowPosition( 200, 200 )
glutInitWindowSize( 800, 600 )
glutCreateWindow( "OpenGL" )
initScene()
glutDisplayFunc( renderScene )
glutIdleFunc( idleScene )
glutMainLoop()
main()