i want to make a 3d rotating cube using pygame and pyopengl after watching a tutorial on Youtube but i keep getting an error. i installed opengl using my terminal.
here is the code
from OpenGL.GL import *from OpenGL.GLU import *import pygamesharps=( (1,1,-1), (-1,1,-1), (-1,-1,-1), (1,-1,-1), (1,1,1), (-1,1,1), (-1,-1,1), (1,-1,1) )lines=( (0,1), (1,2), (2,3), (3,0), (0,4), (4,5), (5,6), (6,7), (7,4), (5,1), (6,2), (7,3) )def cube(): glBegin(GL_LINES) for x in lines: for y in x: glVertex3fv(sharps[y]) glEnd()def main(): pygame.init() x=800 y=600 window=pygame.display.set_mode((x,y), DOUBLEBUF|OPENGL) gluPerspective(45,(x/y),0.1,50.0) glTranslatef(0.0,0.0,-5) glRotatef(0,0,0,0) true = True while true: for i in pygame.event.get(): if i.type==pygame.QUIT: true=False glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT) cube() pygame.display.flip() pygame.time.wait(10)try: main()except Exception, e: print e
and the error
global name 'DOUBLEBUF' is not defined
i dont seem to understand where the problem lie, i mean it worked for the guy in youtube.Please help