File: glutils.py

package info (click to toggle)
pycollada 0.6-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 6,936 kB
  • sloc: python: 17,667; makefile: 98
file content (25 lines) | stat: -rw-r--r-- 612 bytes parent folder | download | duplicates (2)
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