1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
from __future__ import print_function
from __future__ import absolute_import
import pyglet
from pyglet.gl import *
import ctypes
def VecF(*args):
"""Simple function to create ctypes arrays of floats"""
return (GLfloat * len(args))(*args)
def getOpenGLVersion():
"""Get the OpenGL minor and major version number"""
versionString = glGetString(GL_VERSION)
return ctypes.cast(versionString, ctypes.c_char_p).value
def getGLError():
e = glGetError()
if e != 0:
errstr = gluErrorString(e)
print('GL ERROR:', errstr)
return errstr
else:
return None
|