trying to do the nehe tutorial lessons 5 (http://nehe.gamedev.net/data/
lessons/lesson.asp?lesson=05) I came up with this, but I only get a
black screen:
from pyglet.gl import *
from pyglet import window
# The OpenGL context is created only when you create a window. Any
calls
# to OpenGL before a window is created will fail.
win = window.Window(visible=False)
# ... perform any OpenGL state initialisation here.
glShadeModel(GL_SMOOTH)
glClearColor(0, 0, 0, 0.5)
glClearDepth(1.0)
glEnable(GL_DEPTH_TEST)
glDepthFunc(GL_LEQUAL)
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST)
glViewport(0, 0, win.width, win.height)
glMatrixMode(GL_PROJECTION)
glLoadIdentity()
gluPerspective(45, win.width/ float(win.height), 0.1, 100)
glMatrixMode(GL_MODELVIEW)
glLoadIdentity()
win.set_visible()
while not win.has_exit:
win.dispatch_events()
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
glLoadIdentity()
glTranslatef(-1.5, 0, -6)
rtri = 0.0
glRotatef(rtri,0,1.0, 0)
glBegin(GL_TRIANGLES)
glColor3f(1, 0, 0)
glVertex3f(0, 1, 0)
glColor3f(0, 1, 0)
glVertex3f(-1, -1, 1)
glColor3f(0, 0, 1)
glVertex3f(1, -1, 1)
glColor3f(1, 0, 0)
glVertex3f(0, 1, 0)
glColor3f(0, 0, 1)
glVertex3f(1, -1, 1)
glColor3f(0, 1, 0)
glVertex3f(1, -1, -1)
glColor3f(1, 0, 0)
glVertex3f(0, 1, 0)
glColor3f(0, 1, 0)
glVertex3f(1, -1, -1)
glColor3f(0, 0, 1)
glVertex3f(-1, -1, -1)
glColor3f(1, 0, 0)
glVertex3f(0, 1, 0)
glColor3f(0, 0, 1)
glVertex3f(-1, -1, -1)
glColor3f(0, 1, 0)
glVertex3f(-1, -1, 1)
glEnd()
rtri += 0.5
win.flip()
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pyglet-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/pyglet-users?hl=en
-~----------~----~----~----~------~----~------~--~---