def unpack_constants( constants, namespace ): """Create constants and add to the namespace""" from OpenGL.constant import Constant for line in constants.splitlines(): if line and line.split(): name,value = line.split() namespace[name] = Constant( name, int(value,16) )
class OSMesaPlatform( baseplatform.BasePlatform ): """OSMesa implementation for PyOpenGL""" try: GL = OpenGL = ctypesloader.loadLibrary( ctypes.cdll, 'OSMesa', mode=ctypes.RTLD_GLOBAL ) except OSError as err: raise ImportError("Unable to load OpenGL library", *err.args) try: GLU = ctypesloader.loadLibrary( ctypes.cdll, 'GLU', mode=ctypes.RTLD_GLOBAL ) except OSError as err: GLU = None # glut shouldn't need to be global, but just in case a dependent library makes # the same assumption GLUT does... try: GLUT = ctypesloader.loadLibrary( ctypes.cdll, 'glut', mode=ctypes.RTLD_GLOBAL ) except OSError as err: GLUT = None try: GLE = ctypesloader.loadLibrary( ctypes.cdll, 'gle', mode=ctypes.RTLD_GLOBAL ) except OSError as err: GLE = None DEFAULT_FUNCTION_TYPE = staticmethod( ctypes.CFUNCTYPE ) GLenum = ctypes.c_uint GLboolean = ctypes.c_ubyte GLsizei = ctypes.c_int GLint = ctypes.c_int baseplatform.BasePlatform.EXPORTED_NAMES += ['OSMesaCreateContext', 'OSMesaCreateContextExt', 'OSMesaMakeCurrent', 'OSMesaGetIntegerv', 'OSMesaGetCurrentContext', 'OSMesaDestroyContext', 'OSMesaPixelStore', 'OSMesaGetDepthBuffer', 'OSMesaGetColorBuffer', 'OSMESA_COLOR_INDEX', 'OSMESA_RGBA', 'OSMESA_BGRA', 'OSMESA_ARGB', 'OSMESA_RGB', 'OSMESA_BGR', 'OSMESA_BGR', 'OSMESA_ROW_LENGTH', 'OSMESA_Y_UP', 'OSMESA_WIDTH', 'OSMESA_HEIGHT', 'OSMESA_FORMAT', 'OSMESA_TYPE', 'OSMESA_MAX_WIDTH', 'OSMESA_MAX_HEIGHT'] # export OSMesa functions from osmesa.h class struct_osmesa_context(ctypes.Structure): __slots__ = [ ] struct_osmesa_context._fields_ = [ ('_opaque_struct', ctypes.c_int) ] OSMesaContext = ctypes.POINTER(struct_osmesa_context) # Values for the format parameter of OSMesaCreateContext() OSMESA_COLOR_INDEX = Constant('OSMESA_COLOR_INDEX', 6400) OSMESA_RGBA = Constant('OSMESA_RGBA', 6408) OSMESA_BGRA = Constant('OSMESA_BGRA', 0x1) OSMESA_ARGB = Constant('OSMESA_ARGB', 0x2) OSMESA_RGB = Constant('OSMESA_RGB', 6407) OSMESA_BGR = Constant('OSMESA_BGR', 0x4) OSMESA_RGB_565 = Constant('OSMESA_BGR', 0x5) # OSMesaPixelStore() parameters: OSMESA_ROW_LENGTH = Constant('OSMESA_ROW_LENGTH', 0x10) OSMESA_Y_UP = Constant('OSMESA_Y_UP', 0x11) # Accepted by OSMesaGetIntegerv: OSMESA_WIDTH = Constant('OSMESA_WIDTH', 0x20) OSMESA_HEIGHT = Constant('OSMESA_HEIGHT', 0x21) OSMESA_FORMAT = Constant('OSMESA_FORMAT', 0x22) OSMESA_TYPE = Constant('OSMESA_TYPE', 0x23) OSMESA_MAX_WIDTH = Constant('OSMESA_MAX_WIDTH', 0x24) OSMESA_MAX_HEIGHT = Constant('OSMESA_MAX_HEIGHT', 0x25) OSMesaCreateContext = GL.OSMesaCreateContext OSMesaCreateContext.argtypes = [GLenum, OSMesaContext] OSMesaCreateContext.restype = OSMesaContext OSMesaCreateContextExt = GL.OSMesaCreateContextExt OSMesaCreateContextExt.argtypes = [GLenum, GLint, GLint, GLint, OSMesaContext] OSMesaCreateContextExt.restype = OSMesaContext OSMesaDestroyContext = GL.OSMesaDestroyContext OSMesaDestroyContext.argtypes = [OSMesaContext] OSMesaMakeCurrent = GL.OSMesaMakeCurrent OSMesaMakeCurrent.argtypes = [OSMesaContext, ctypes.POINTER(None), GLenum, GLsizei, GLsizei] OSMesaMakeCurrent.restype = GLboolean OSMesaGetCurrentContext = GL.OSMesaGetCurrentContext #OSMesaGetCurrentContext.restype = OSMesaContext GetCurrentContext = CurrentContextIsValid = OSMesaGetCurrentContext OSMesaPixelStore = GL.OSMesaPixelStore OSMesaPixelStore.argtypes = [GLint, GLint] OSMesaPixelStore.restype = None OSMesaGetProcAddress = GL.OSMesaGetProcAddress OSMesaGetProcAddress.restype = ctypes.c_void_p getExtensionProcedure = staticmethod( OSMesaGetProcAddress ) def OSMesaGetIntegerv(self, pname): value = self.GLint() self.GL.OSMesaGetIntegerv(pname, ctypes.byref(value)) return value.value def OSMesaGetDepthBuffer(self, c): width, height, bytesPerValue = self.GLint(), self.GLint(), self.GLint() buffer = ctypes.POINTER(self.GLint)() if self.GL.OSMesaGetDepthBuffer(c, ctypes.byref(width), ctypes.byref(height), ctypes.byref(bytesPerValue), ctypes.byref(buffer)): return width.value, height.value, bytesPerValue.value, buffer else: return 0, 0, 0, None def OSMesaGetColorBuffer(self, c): # TODO: make output array types which can handle the operation # provide an API to convert pointers + sizes to array instances, # e.g. numpy.ctypeslib.as_array( ptr, bytesize ).astype( 'B' ).reshape( height,width ) width, height, format = self.GLint(), self.GLint(), self.GLint() buffer = ctypes.c_void_p() if self.GL.OSMesaGetColorBuffer(c, ctypes.byref(width), ctypes.byref(height), ctypes.byref(format), ctypes.byref(buffer)): return width.value, height.value, format.value, buffer else: return 0, 0, 0, None def getGLUTFontPointer( self, constant ): """Platform specific function to retrieve a GLUT font pointer GLUTAPI void *glutBitmap9By15; #define GLUT_BITMAP_9_BY_15 (&glutBitmap9By15) Key here is that we want the addressof the pointer in the DLL, not the pointer in the DLL. That is, our pointer is to the pointer defined in the DLL, we don't want the *value* stored in that pointer. """ name = [ x.title() for x in constant.split( '_' )[1:] ] internal = 'glut' + "".join( [x.title() for x in name] ) pointer = ctypes.c_void_p.in_dll( self.GLUT, internal ) return ctypes.c_void_p(ctypes.addressof(pointer)) safeGetError = staticmethod( OpenGL.glGetError )
"""OpenGL-wide constant types (not OpenGL.GL-specific""" import ctypes from OpenGL.constant import Constant GL_FALSE = Constant('GL_FALSE', 0x0) GL_TRUE = Constant('GL_TRUE', 0x1) GL_BYTE = Constant('GL_BYTE', 0x1400) GL_UNSIGNED_BYTE = Constant('GL_UNSIGNED_BYTE', 0x1401) GL_SHORT = Constant('GL_SHORT', 0x1402) GL_UNSIGNED_SHORT = Constant('GL_UNSIGNED_SHORT', 0x1403) GL_INT = Constant('GL_INT', 0x1404) GL_UNSIGNED_INT = Constant('GL_UNSIGNED_INT', 0x1405) GL_FLOAT = Constant('GL_FLOAT', 0x1406) GL_DOUBLE = Constant('GL_DOUBLE', 0x140a) GL_CHAR = str GL_HALF_NV = Constant('GL_HALF_NV', 0x1401) # Basic OpenGL data-types as ctypes declarations... def _defineType(name, baseType, convertFunc=long): import OpenGL if OpenGL.ALLOW_NUMPY_SCALARS: original = baseType.from_param def from_param(x): try: return original(x) except TypeError, err: try: return original(convertFunc(x)) except TypeError, err2:
'OSMesaPixelStore', 'OSMesaGetDepthBuffer', 'OSMesaGetColorBuffer', 'OSMESA_COLOR_INDEX', 'OSMESA_RGBA', 'OSMESA_BGRA', 'OSMESA_ARGB', 'OSMESA_RGB', 'OSMESA_BGR', 'OSMESA_BGR', 'OSMESA_ROW_LENGTH', 'OSMESA_Y_UP', 'OSMESA_WIDTH', 'OSMESA_HEIGHT', 'OSMESA_FORMAT', 'OSMESA_TYPE', 'OSMESA_MAX_WIDTH', 'OSMESA_MAX_HEIGHT' ] # export OSMesa functions from osmesa.h class struct_osmesa_context(ctypes.Structure): __slots__ = [] struct_osmesa_context._fields_ = [('_opaque_struct', ctypes.c_int)] OSMesaContext = ctypes.POINTER(struct_osmesa_context) # Values for the format parameter of OSMesaCreateContext() OSMESA_COLOR_INDEX = Constant('OSMESA_COLOR_INDEX', 6400) OSMESA_RGBA = Constant('OSMESA_RGBA', 6408) OSMESA_BGRA = Constant('OSMESA_BGRA', 0x1) OSMESA_ARGB = Constant('OSMESA_ARGB', 0x2) OSMESA_RGB = Constant('OSMESA_RGB', 6407) OSMESA_BGR = Constant('OSMESA_BGR', 0x4) OSMESA_RGB_565 = Constant('OSMESA_BGR', 0x5) # OSMesaPixelStore() parameters: OSMESA_ROW_LENGTH = Constant('OSMESA_ROW_LENGTH', 0x10) OSMESA_Y_UP = Constant('OSMESA_Y_UP', 0x11) # Accepted by OSMesaGetIntegerv: OSMESA_WIDTH = Constant('OSMESA_WIDTH', 0x20) OSMESA_HEIGHT = Constant('OSMESA_HEIGHT', 0x21) OSMESA_FORMAT = Constant('OSMESA_FORMAT', 0x22)
"""OpenGL-wide constant types (not OpenGL.GL-specific) These are basically the fundamental data-types that OpenGL uses (doesn"t include the OpenGL-ES types!)""" import ctypes from OpenGL.constant import Constant from OpenGL._bytes import bytes, unicode, as_8_bit, long from OpenGL._opaque import opaque_pointer_cls as _opaque_pointer_cls from OpenGL.platform import PLATFORM as _p assert unicode assert as_8_bit sizeof = ctypes.sizeof GL_FALSE = Constant("GL_FALSE", 0x0) GL_TRUE = Constant("GL_TRUE", 0x1) GL_BYTE = Constant("GL_BYTE", 0x1400) GL_UNSIGNED_BYTE = Constant("GL_UNSIGNED_BYTE", 0x1401) GL_SHORT = Constant("GL_SHORT", 0x1402) GL_UNSIGNED_SHORT = Constant("GL_UNSIGNED_SHORT", 0x1403) GL_INT = Constant("GL_INT", 0x1404) GL_UNSIGNED_INT = Constant("GL_UNSIGNED_INT", 0x1405) GL_UNSIGNED_INT64 = Constant("GL_UNSIGNED_INT64_AMD", 0x8BC2) GL_FLOAT = Constant("GL_FLOAT", 0x1406) GL_DOUBLE = Constant("GL_DOUBLE", 0x140a) GL_CHAR = bytes GL_HALF_FLOAT = Constant("GL_HALF_FLOAT_ARB", 0x140B) GL_HALF_NV = Constant("GL_HALF_NV", 0x1401) GL_FIXED = Constant("GL_FIXED", 0x140C) GL_VOID_P = object()
"""Constants for OpenGL.GLUT Automatically generated by the generateraw script, do not edit! """ from ctypes import * from OpenGL import platform, arrays from OpenGL.constant import Constant from OpenGL.raw.GL import _types as GL_types GLvoid = GL_types.GLvoid GLUT_ACCUM = Constant("GLUT_ACCUM", 4) GLUT_ACTIVE_ALT = Constant("GLUT_ACTIVE_ALT", 4) GLUT_ACTIVE_CTRL = Constant("GLUT_ACTIVE_CTRL", 2) GLUT_ACTIVE_SHIFT = Constant("GLUT_ACTIVE_SHIFT", 1) GLUT_ALPHA = Constant("GLUT_ALPHA", 8) GLUT_API_VERSION = Constant("GLUT_API_VERSION", 4) GLUT_BLUE = Constant("GLUT_BLUE", 2) GLUT_CURSOR_BOTTOM_LEFT_CORNER = Constant("GLUT_CURSOR_BOTTOM_LEFT_CORNER", 19) GLUT_CURSOR_BOTTOM_RIGHT_CORNER = Constant("GLUT_CURSOR_BOTTOM_RIGHT_CORNER", 18) GLUT_CURSOR_BOTTOM_SIDE = Constant("GLUT_CURSOR_BOTTOM_SIDE", 13) GLUT_CURSOR_CROSSHAIR = Constant("GLUT_CURSOR_CROSSHAIR", 9) GLUT_CURSOR_CYCLE = Constant("GLUT_CURSOR_CYCLE", 5) GLUT_CURSOR_DESTROY = Constant("GLUT_CURSOR_DESTROY", 3) GLUT_CURSOR_FULL_CROSSHAIR = Constant("GLUT_CURSOR_FULL_CROSSHAIR", 102) GLUT_CURSOR_HELP = Constant("GLUT_CURSOR_HELP", 4) GLUT_CURSOR_INFO = Constant("GLUT_CURSOR_INFO", 2) GLUT_CURSOR_INHERIT = Constant("GLUT_CURSOR_INHERIT", 100) GLUT_CURSOR_LEFT_ARROW = Constant("GLUT_CURSOR_LEFT_ARROW", 1)
"""Constants for OpenGL.GLU Automatically generated by the generateraw script, do not edit! """ from ctypes import * from OpenGL import platform, arrays from OpenGL.constant import Constant from OpenGL.raw.GL import _types as GL_types GLvoid = GL_types.GLvoid GLU_AUTO_LOAD_MATRIX = Constant("GLU_AUTO_LOAD_MATRIX", 100200) GLU_BEGIN = Constant("GLU_BEGIN", 100100) GLU_CCW = Constant("GLU_CCW", 100121) GLU_CULLING = Constant("GLU_CULLING", 100201) GLU_CW = Constant("GLU_CW", 100120) GLU_DISPLAY_MODE = Constant("GLU_DISPLAY_MODE", 100204) GLU_DOMAIN_DISTANCE = Constant("GLU_DOMAIN_DISTANCE", 100217) GLU_EDGE_FLAG = Constant("GLU_EDGE_FLAG", 100104) GLU_END = Constant("GLU_END", 100102) GLU_ERROR = Constant("GLU_ERROR", 100103) GLU_EXTENSIONS = Constant("GLU_EXTENSIONS", 100801) GLU_EXTERIOR = Constant("GLU_EXTERIOR", 100123) GLU_FALSE = Constant("GLU_FALSE", 0) GLU_FILL = Constant("GLU_FILL", 100012) GLU_FLAT = Constant("GLU_FLAT", 100001) GLU_INCOMPATIBLE_GL_VERSION = Constant("GLU_INCOMPATIBLE_GL_VERSION", 100903) GLU_INSIDE = Constant("GLU_INSIDE", 100021) GLU_INTERIOR = Constant("GLU_INTERIOR", 100122) GLU_INVALID_ENUM = Constant("GLU_INVALID_ENUM", 100900) GLU_INVALID_OPERATION = Constant("GLU_INVALID_OPERATION", 100904)
"""Constants for OpenGL.GLUT Automatically generated by the generateraw script, do not edit! """ from ctypes import * from OpenGL import platform, arrays from OpenGL.constant import Constant from OpenGL.raw.GL import _types as GL_types GLvoid = GL_types.GLvoid GLUT_ACCUM = Constant('GLUT_ACCUM', 4) GLUT_ACTIVE_ALT = Constant('GLUT_ACTIVE_ALT', 4) GLUT_ACTIVE_CTRL = Constant('GLUT_ACTIVE_CTRL', 2) GLUT_ACTIVE_SHIFT = Constant('GLUT_ACTIVE_SHIFT', 1) GLUT_ALPHA = Constant('GLUT_ALPHA', 8) GLUT_API_VERSION = Constant('GLUT_API_VERSION', 4) GLUT_BLUE = Constant('GLUT_BLUE', 2) GLUT_CURSOR_BOTTOM_LEFT_CORNER = Constant('GLUT_CURSOR_BOTTOM_LEFT_CORNER', 19) GLUT_CURSOR_BOTTOM_RIGHT_CORNER = Constant('GLUT_CURSOR_BOTTOM_RIGHT_CORNER', 18) GLUT_CURSOR_BOTTOM_SIDE = Constant('GLUT_CURSOR_BOTTOM_SIDE', 13) GLUT_CURSOR_CROSSHAIR = Constant('GLUT_CURSOR_CROSSHAIR', 9) GLUT_CURSOR_CYCLE = Constant('GLUT_CURSOR_CYCLE', 5) GLUT_CURSOR_DESTROY = Constant('GLUT_CURSOR_DESTROY', 3) GLUT_CURSOR_FULL_CROSSHAIR = Constant('GLUT_CURSOR_FULL_CROSSHAIR', 102) GLUT_CURSOR_HELP = Constant('GLUT_CURSOR_HELP', 4) GLUT_CURSOR_INFO = Constant('GLUT_CURSOR_INFO', 2) GLUT_CURSOR_INHERIT = Constant('GLUT_CURSOR_INHERIT', 100) GLUT_CURSOR_LEFT_ARROW = Constant('GLUT_CURSOR_LEFT_ARROW', 1)
"""Constants for OpenGL.GLU Automatically generated by the generateraw script, do not edit! """ from ctypes import * from OpenGL import platform, arrays from OpenGL.constant import Constant from OpenGL import constants as GLconstants GLvoid = GLconstants.GLvoid GLU_AUTO_LOAD_MATRIX = Constant('GLU_AUTO_LOAD_MATRIX', 100200) GLU_BEGIN = Constant('GLU_BEGIN', 100100) GLU_CCW = Constant('GLU_CCW', 100121) GLU_CULLING = Constant('GLU_CULLING', 100201) GLU_CW = Constant('GLU_CW', 100120) GLU_DISPLAY_MODE = Constant('GLU_DISPLAY_MODE', 100204) GLU_DOMAIN_DISTANCE = Constant('GLU_DOMAIN_DISTANCE', 100217) GLU_EDGE_FLAG = Constant('GLU_EDGE_FLAG', 100104) GLU_END = Constant('GLU_END', 100102) GLU_ERROR = Constant('GLU_ERROR', 100103) GLU_EXTENSIONS = Constant('GLU_EXTENSIONS', 100801) GLU_EXTERIOR = Constant('GLU_EXTERIOR', 100123) GLU_FALSE = Constant('GLU_FALSE', 0) GLU_FILL = Constant('GLU_FILL', 100012) GLU_FLAT = Constant('GLU_FLAT', 100001) GLU_INCOMPATIBLE_GL_VERSION = Constant('GLU_INCOMPATIBLE_GL_VERSION', 100903) GLU_INSIDE = Constant('GLU_INSIDE', 100021) GLU_INTERIOR = Constant('GLU_INTERIOR', 100122) GLU_INVALID_ENUM = Constant('GLU_INVALID_ENUM', 100900) GLU_INVALID_OPERATION = Constant('GLU_INVALID_OPERATION', 100904)
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with PyCAM. If not, see <http://www.gnu.org/licenses/>. """ import math import sys import OpenGL.GL as GL import OpenGL.GLU as GLU import OpenGL.GLUT as GLUT from OpenGL.constant import Constant GLUT_WHEEL_UP = Constant('GLUT_WHEEL_UP', 3) GLUT_WHEEL_DOWN = Constant('GLUT_WHEEL_DOWN', 4) _DrawCurrentSceneFunc = None _KeyHandlerFunc = None # Some api in the chain is translating the keystrokes to this octal string # so instead of saying: ESCAPE = 27, we use the following. ESCAPE = '\033' # Number of the glut window. window = 0 # Rotations for cube. xrot = 110 yrot = 180
"""Constants for OpenGL.GLE Automatically generated by the generateraw script, do not edit! """ from ctypes import * from OpenGL import platform, arrays from OpenGL.constant import Constant from OpenGL.raw.GL import _types as GL_types GLvoid = GL_types.GLvoid GLE_TEXTURE_ENABLE = Constant('GLE_TEXTURE_ENABLE', 65536) GLE_TEXTURE_NORMAL_CYL = Constant('GLE_TEXTURE_NORMAL_CYL', 4) GLE_TEXTURE_NORMAL_FLAT = Constant('GLE_TEXTURE_NORMAL_FLAT', 2) GLE_TEXTURE_NORMAL_MODEL_CYL = Constant('GLE_TEXTURE_NORMAL_MODEL_CYL', 10) GLE_TEXTURE_NORMAL_MODEL_FLAT = Constant('GLE_TEXTURE_NORMAL_MODEL_FLAT', 8) GLE_TEXTURE_NORMAL_MODEL_SPH = Constant('GLE_TEXTURE_NORMAL_MODEL_SPH', 12) GLE_TEXTURE_NORMAL_SPH = Constant('GLE_TEXTURE_NORMAL_SPH', 6) GLE_TEXTURE_STYLE_MASK = Constant('GLE_TEXTURE_STYLE_MASK', 255) GLE_TEXTURE_VERTEX_CYL = Constant('GLE_TEXTURE_VERTEX_CYL', 3) GLE_TEXTURE_VERTEX_FLAT = Constant('GLE_TEXTURE_VERTEX_FLAT', 1) GLE_TEXTURE_VERTEX_MODEL_CYL = Constant('GLE_TEXTURE_VERTEX_MODEL_CYL', 9) GLE_TEXTURE_VERTEX_MODEL_FLAT = Constant('GLE_TEXTURE_VERTEX_MODEL_FLAT', 7) GLE_TEXTURE_VERTEX_MODEL_SPH = Constant('GLE_TEXTURE_VERTEX_MODEL_SPH', 11) GLE_TEXTURE_VERTEX_SPH = Constant('GLE_TEXTURE_VERTEX_SPH', 5) TUBE_CONTOUR_CLOSED = Constant('TUBE_CONTOUR_CLOSED', 4096) TUBE_JN_ANGLE = Constant('TUBE_JN_ANGLE', 2) TUBE_JN_CAP = Constant('TUBE_JN_CAP', 16) TUBE_JN_CUT = Constant('TUBE_JN_CUT', 3) TUBE_JN_MASK = Constant('TUBE_JN_MASK', 15) TUBE_JN_RAW = Constant('TUBE_JN_RAW', 1)
"""Constants for OpenGL.GLE Automatically generated by the generateraw script, do not edit! """ from ctypes import * from OpenGL import platform, arrays from OpenGL.constant import Constant from OpenGL.raw.GL import _types as GL_types GLvoid = GL_types.GLvoid GLE_TEXTURE_ENABLE = Constant("GLE_TEXTURE_ENABLE", 65536) GLE_TEXTURE_NORMAL_CYL = Constant("GLE_TEXTURE_NORMAL_CYL", 4) GLE_TEXTURE_NORMAL_FLAT = Constant("GLE_TEXTURE_NORMAL_FLAT", 2) GLE_TEXTURE_NORMAL_MODEL_CYL = Constant("GLE_TEXTURE_NORMAL_MODEL_CYL", 10) GLE_TEXTURE_NORMAL_MODEL_FLAT = Constant("GLE_TEXTURE_NORMAL_MODEL_FLAT", 8) GLE_TEXTURE_NORMAL_MODEL_SPH = Constant("GLE_TEXTURE_NORMAL_MODEL_SPH", 12) GLE_TEXTURE_NORMAL_SPH = Constant("GLE_TEXTURE_NORMAL_SPH", 6) GLE_TEXTURE_STYLE_MASK = Constant("GLE_TEXTURE_STYLE_MASK", 255) GLE_TEXTURE_VERTEX_CYL = Constant("GLE_TEXTURE_VERTEX_CYL", 3) GLE_TEXTURE_VERTEX_FLAT = Constant("GLE_TEXTURE_VERTEX_FLAT", 1) GLE_TEXTURE_VERTEX_MODEL_CYL = Constant("GLE_TEXTURE_VERTEX_MODEL_CYL", 9) GLE_TEXTURE_VERTEX_MODEL_FLAT = Constant("GLE_TEXTURE_VERTEX_MODEL_FLAT", 7) GLE_TEXTURE_VERTEX_MODEL_SPH = Constant("GLE_TEXTURE_VERTEX_MODEL_SPH", 11) GLE_TEXTURE_VERTEX_SPH = Constant("GLE_TEXTURE_VERTEX_SPH", 5) TUBE_CONTOUR_CLOSED = Constant("TUBE_CONTOUR_CLOSED", 4096) TUBE_JN_ANGLE = Constant("TUBE_JN_ANGLE", 2) TUBE_JN_CAP = Constant("TUBE_JN_CAP", 16) TUBE_JN_CUT = Constant("TUBE_JN_CUT", 3) TUBE_JN_MASK = Constant("TUBE_JN_MASK", 15) TUBE_JN_RAW = Constant("TUBE_JN_RAW", 1)
"""OpenGL-wide constant types (not OpenGL.GL-specific) These are basically the fundamental data-types that OpenGL uses (note, doesn't include the OpenGL-ES types!) """ import ctypes from OpenGL.constant import Constant from OpenGL._bytes import bytes, unicode, as_8_bit, long assert unicode assert as_8_bit from OpenGL._opaque import opaque_pointer_cls as _opaque_pointer_cls sizeof = ctypes.sizeof GL_FALSE = Constant('GL_FALSE', 0x0) GL_TRUE = Constant('GL_TRUE', 0x1) GL_BYTE = Constant('GL_BYTE', 0x1400) GL_UNSIGNED_BYTE = Constant('GL_UNSIGNED_BYTE', 0x1401) GL_SHORT = Constant('GL_SHORT', 0x1402) GL_UNSIGNED_SHORT = Constant('GL_UNSIGNED_SHORT', 0x1403) GL_INT = Constant('GL_INT', 0x1404) GL_UNSIGNED_INT = Constant('GL_UNSIGNED_INT', 0x1405) GL_UNSIGNED_INT64 = Constant('GL_UNSIGNED_INT64_AMD', 0x8BC2) GL_FLOAT = Constant('GL_FLOAT', 0x1406) GL_DOUBLE = Constant('GL_DOUBLE', 0x140a) GL_CHAR = bytes GL_HALF_FLOAT = Constant('GL_HALF_FLOAT_ARB', 0x140B) GL_HALF_NV = Constant('GL_HALF_NV', 0x1401) GL_FIXED = Constant('GL_FIXED', 0x140C) GL_VOID_P = object()