File: glutils.py

package info (click to toggle)
pycollada 0.8-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 9,116 kB
  • sloc: xml: 11,085; python: 6,859; makefile: 87
file content (27 lines) | stat: -rw-r--r-- 614 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
26
27
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