I'm trying some stuff under PyGlet and I'm facing an issue I can't manage to solve by myself.
import pyglet
from pyglet import gl
win = pyglet.window.Window()
@win.event
def on_draw():
gl.glClear(gl.GL_COLOR_BUFFER_BIT)
z = 0
gl.glBegin(gl.GL_QUADS)
gl.glColor3ub(0xff, 0x00, 0x00)
gl.glVertex3d(50, 50, z)
gl.glVertex3d(50, 100, z)
gl.glVertex3d(100, 100, z)
gl.glVertex3d(100, 50, z)
gl.glEnd()
pyglet.app.run()
This code draws a square on the screen. But if I set z to be something else than -1, 0 or 1, the square isn't showing.
I would like to build a rotating cube, so I need this z axis.
Any help on this ?
Thanks
Without any additional OpenGL setting, the valid range for Z is any float in the range (-1.0, 1.0) only. Your vertexes will be ignored if z coordinate is outside.