Révision 11 PyOpenGL-Demo/redbook/fog.py

fog.py (revision 11)
2 2

  
3 3
# This is statement is required by the build system to query build info
4 4
if __name__ == '__build__':
5
	raise Exception
5
	raise(Exception)
6 6

  
7 7
'''
8 8
fog.c from the Redbook examples.  
......
64 64
  from OpenGL.GLUT import *
65 65
  from OpenGL.GL import *
66 66
except:
67
  print '''
67
  print('''
68 68
ERROR: PyOpenGL not installed properly.  
69
        '''
69
        ''')
70 70
  sys.exit()
71 71

  
72 72

  
......
108 108

  
109 109
# display() draws 5 spheres at different z positions.
110 110
def display():
111
   print 'redisplay'
111
   print('redisplay')
112 112
   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
113 113
   renderSphere (-2., -0.5, -1.0)
114 114
   renderSphere (-1., -0.5, -2.0)
......
130 130

  
131 131
def keyboard(key, x, y):
132 132
  global fogMode
133
  if key in ['f','F']:
133
  if key in [b'f',b'F']:
134 134
    if (fogMode == GL_EXP):
135 135
      fogMode = GL_EXP2;
136
      print "Fog mode is GL_EXP2"
136
      print("Fog mode is GL_EXP2")
137 137
    elif (fogMode == GL_EXP2):
138 138
      fogMode = GL_LINEAR
139
      print "Fog mode is GL_LINEAR"
139
      print("Fog mode is GL_LINEAR")
140 140
    elif (fogMode == GL_LINEAR):
141 141
      fogMode = GL_EXP
142
      print "Fog mode is GL_EXP"
142
      print("Fog mode is GL_EXP")
143 143
    glFogi(GL_FOG_MODE, fogMode)
144 144
    glutPostRedisplay()
145 145
  
......
154 154
glutInit(sys.argv)
155 155
glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH);
156 156
glutInitWindowSize(500, 500)
157
glutCreateWindow('fog')
157
glutCreateWindow(b'fog')
158 158
init()
159 159
glutReshapeFunc(reshape)
160 160
glutKeyboardFunc(keyboard)

Formats disponibles : Unified diff