from ctypes import c_void_p import OpenGL.GL as GL import OpenGL.GL.ARB.vertex_array_object as GLARBVAO for name in dir(GLARBVAO): GL.__setattr__(name, GLARBVAO.__getattribute__(name)) from OpenGL.GL.shaders import compileShader, compileProgram import pygame from pygame.locals import * import numpy as N null = c_void_p(0) # This is lame. What's the right way to get the sizeof(GLfloat) ? # Tried sys.getsizeof(GLfloat), sys.getsizeof(GLfloat()), # GLfloat().__sizeof__(). All give different wrong answers (size of python # objects, not of underlying C 'float' type) sizeOfFloat = 4 # Three vertices, with an x,y,z & w for each. vertexData = N.array([ 0.25, 0.25, 0.75, 1.0, 0.25, -0.25, 0.75, 1.0, -0.25, 0.25, 0.75, 1.0, 0.25, -0.25, 0.75, 1.0,