Beispiel #1
0
def main():
    glutInit(sys.argv)
    glutInitDisplayMode( GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH)
    twInitWindowSize(window_width,window_height)
    glutCreateWindow(sys.argv[0])
    glutDisplayFunc(display)
#    glEnable(GL_NORMALIZE)      # twMainInit does this
    twBoundingBox(0,1,0,1,0,1)   # fake, just to avoid complaints
    twMainInit()
    myReshape(window_width,window_height)
    glutReshapeFunc(myReshape);
    glutKeyboardFunc(key);
    glutMouseFunc(mouse);
    glutMotionFunc(motion);
    TennisBall.setupCoords(20)
#    glEnable(GL_DEPTH_TEST);    # twMainInit does this
    glutMainLoop();
Beispiel #2
0
def display():
    glPushAttrib(GL_ALL_ATTRIB_BITS);
    glClearColor(1,1,1,1);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glPushMatrix();     
    place_camera(); 
    lighting()
    drawGround()
    Court.drawTennisCourt() 
    placeScoreCards()
    positionRacquet()
    TennisBall.drawBalls(20)   
    Net.drawFullNet()
    glPopMatrix()
    cameraDrawing() 
    glFlush();
    glutSwapBuffers();
    glPopAttrib();