Exemplo n.º 1
0
 def _vispy_get_native_app(self):
     # HiDPI support for retina display
     # This requires glut from
     # http://iihm.imag.fr/blanch/software/glut-macosx/
     if sys.platform == 'darwin':
         try:
             glutInitDisplayString = platform.createBaseFunction(
                 'glutInitDisplayString',
                 dll=platform.GLUT,
                 resultType=None,
                 argTypes=[
                     ctypes.c_char_p],
                 doc='glutInitDisplayString(  ) -> None',
                 argNames=())
             text = ctypes.c_char_p("rgba stencil double samples=8 hidpi")
             glutInitDisplayString(text)
         except:
             pass
     if not self._initialized:
         glut.glutInit()  # todo: maybe allow user to give args?
         glut.glutInitDisplayMode(glut.GLUT_RGBA |
                                  glut.GLUT_DOUBLE |
                                  glut.GLUT_STENCIL |
                                  glut.GLUT_DEPTH)
         self._initialized = True
     return glut
Exemplo n.º 2
0
Arquivo: _glut.py Projeto: kif/vispy
def _init_glut():
    # HiDPI support for retina display
    # This requires glut from
    # http://iihm.imag.fr/blanch/software/glut-macosx/
    if sys.platform == 'darwin':
        try:
            glutInitDisplayString = platform.createBaseFunction(
                'glutInitDisplayString', dll=platform.GLUT,
                resultType=None, argTypes=[ctypes.c_char_p],
                doc='glutInitDisplayString(  ) -> None', argNames=())
            text = ctypes.c_char_p("rgba stencil double samples=8 hidpi")
            glutInitDisplayString(text)
        except Exception:
            pass
    glut.glutInit(['vispy'.encode('ASCII')])  # todo: allow user to give args?
    mode = (glut.GLUT_RGBA | glut.GLUT_DOUBLE |
            glut.GLUT_STENCIL | glut.GLUT_DEPTH)
    if bool(glut.glutInitDisplayMode):
        glut.glutInitDisplayMode(mode)
    # Prevent exit when closing window
    try:
        glut.glutSetOption(glut.GLUT_ACTION_ON_WINDOW_CLOSE,
                           glut.GLUT_ACTION_CONTINUE_EXECUTION)
    except Exception:
        pass
    return glut
Exemplo n.º 3
0
    def _vispy_get_native_app(self):
        import sys, ctypes
        from OpenGL import platform

        # HiDPI support for retina display
        # This requires glut from http://iihm.imag.fr/blanch/software/glut-macosx/
        if sys.platform == 'darwin':
            try:
                glutInitDisplayString = platform.createBaseFunction(
                    'glutInitDisplayString',
                    dll=platform.GLUT,
                    resultType=None,
                    argTypes=[ctypes.c_char_p],
                    doc='glutInitDisplayString(  ) -> None',
                    argNames=())
                text = ctypes.c_char_p("rgba stencil double samples=8 hidpi")
                glutInitDisplayString(text)
            except:
                pass
        if not self._inizialized:
            glut.glutInit()  # todo: maybe allow user to give args?
            self._inizialized = True
        return glut
Exemplo n.º 4
0
Arquivo: glut.py Projeto: joe311/vispy
    def _vispy_get_native_app(self):
        import sys, ctypes
        from OpenGL import platform

        # HiDPI support for retina display
        # This requires glut from http://iihm.imag.fr/blanch/software/glut-macosx/
        if sys.platform == "darwin":
            try:
                glutInitDisplayString = platform.createBaseFunction(
                    "glutInitDisplayString",
                    dll=platform.GLUT,
                    resultType=None,
                    argTypes=[ctypes.c_char_p],
                    doc="glutInitDisplayString(  ) -> None",
                    argNames=(),
                )
                text = ctypes.c_char_p("rgba stencil double samples=8 hidpi")
                glutInitDisplayString(text)
            except:
                pass
        if not self._inizialized:
            glut.glutInit()  # todo: maybe allow user to give args?
            self._inizialized = True
        return glut
Exemplo n.º 5
0
from OpenGL.platform import GLUT, CurrentContextIsValid, GLUT_GUARD_CALLBACKS
from OpenGL import contextdata, error, platform, logs
from OpenGL.raw import GLUT as simple
from OpenGL._bytes import bytes, _NULL_8_BYTE, as_8_bit
import ctypes, os, sys, traceback
PLATFORM = platform.PLATFORM
FUNCTION_TYPE = simple.CALLBACK_FUNCTION_TYPE

log = logs.getLog( 'OpenGL.GLUT.special' )

if os.name == "nt":
    log.info( """Using NT-specific GLUT calls with exit callbacks""" )
    _exitfunctype = FUNCTION_TYPE( None, ctypes.c_int )
    __glutInitWithExit = platform.createBaseFunction(
        '__glutInitWithExit', dll=platform.GLUT, resultType=None,
        argTypes=[ctypes.POINTER(ctypes.c_int),ctypes.POINTER(ctypes.c_char_p),_exitfunctype],
        doc='glutInit( POINTER(c_int)(pargc), POINTER(STRING)(argv) ) -> None',
        argNames=('pargc', 'argv'),
    )
    __glutCreateWindowWithExit = platform.createBaseFunction(
        '__glutCreateWindowWithExit', dll=platform.GLUT, resultType=ctypes.c_int,
        argTypes=[ctypes.c_char_p,_exitfunctype],
        doc='glutCreateWindow( STRING(title) ) -> c_int',
        argNames=('title',),
    )
    __glutCreateMenuWithExit = platform.createBaseFunction( 
        '__glutCreateMenuWithExit', dll=platform.GLUT, resultType=ctypes.c_int, 
        argTypes=[FUNCTION_TYPE(None, ctypes.c_int),_exitfunctype],
        doc='glutCreateMenu( FUNCTION_TYPE(None, c_int)(callback) ) -> c_int', 
        argNames=('callback',),
    )
else:
Exemplo n.º 6
0
            self.callbacks = {}
        self.callbacks[which] = cCallback
        return cCallback


GLUquadric = GLUQuadric


def gluQuadricCallback(quadric, which=_simple.GLU_ERROR, function=None):
    """Set the GLU error callback function"""
    return quadric.addCallback(which, function)


# Override to produce instances of the sub-class...
gluNewQuadric = createBaseFunction(
    "gluNewQuadric",
    dll=PLATFORM.GLU,
    resultType=ctypes.POINTER(GLUQuadric),
    argTypes=[],
    doc="""gluNewQuadric() -> GLUQuadric
    
Create a new GLUQuadric object""",
    argNames=[],
)

__all__ = (
    "gluNewQuadric",
    "gluQuadricCallback",
    "GLUQuadric",
)
Exemplo n.º 7
0
"""OSX specific extensions to GLUT"""
from OpenGL import platform
from OpenGL import constant
from OpenGL.GLUT import special

GLUT_NO_RECOVERY = constant.Constant( 'GLUT_NO_RECOVERY', 1024)
GLUT_3_2_CORE_PROFILE = constant.Constant( 'GLUT_3_2_CORE_PROFILE', 2048)

glutCheckLoop = platform.createBaseFunction( 
    'glutCheckLoop', dll=platform.PLATFORM.GLUT, resultType=None, 
    argTypes=[],
    doc='glutCheckLoop(  ) -> None', 
    argNames=(),
)

glutWMCloseFunc = special.GLUTCallback(
    'WMClose', (), (),
)
Exemplo n.º 8
0
from OpenGL.platform import GLUT, CurrentContextIsValid, GLUT_GUARD_CALLBACKS
from OpenGL import contextdata, error, platform, logs
from OpenGL.raw import GLUT as simple
from OpenGL._bytes import bytes, _NULL_8_BYTE, as_8_bit
import ctypes, os, sys, traceback
PLATFORM = platform.PLATFORM
FUNCTION_TYPE = simple.CALLBACK_FUNCTION_TYPE

log = logs.getLog( 'OpenGL.GLUT.special' )

if os.name == "nt":
    log.info( """Using NT-specific GLUT calls with exit callbacks""" )
    _exitfunctype = FUNCTION_TYPE( None, ctypes.c_int )
    __glutInitWithExit = platform.createBaseFunction(
        '__glutInitWithExit', dll=platform.GLUT, resultType=None,
        argTypes=[ctypes.POINTER(ctypes.c_int),ctypes.POINTER(ctypes.c_char_p),_exitfunctype],
        doc='glutInit( POINTER(c_int)(pargc), POINTER(STRING)(argv) ) -> None',
        argNames=('pargc', 'argv'),
    )
    __glutCreateWindowWithExit = platform.createBaseFunction(
        '__glutCreateWindowWithExit', dll=platform.GLUT, resultType=ctypes.c_int,
        argTypes=[ctypes.c_char_p,_exitfunctype],
        doc='glutCreateWindow( STRING(title) ) -> c_int',
        argNames=('title',),
    )
    __glutCreateMenuWithExit = platform.createBaseFunction( 
        '__glutCreateMenuWithExit', dll=platform.GLUT, resultType=ctypes.c_int, 
        argTypes=[FUNCTION_TYPE(None, ctypes.c_int),_exitfunctype],
        doc='glutCreateMenu( FUNCTION_TYPE(None, c_int)(callback) ) -> c_int', 
        argNames=('callback',),
    )
else:
Exemplo n.º 9
0
class GLUtesselator(Structure):
    pass


GLUtesselator._fields_ = [
    # /usr/include/GL/glu.h 259
]
GLUtesselatorObj = GLUtesselator
GLUtriangulatorObj = GLUtesselator

# /usr/include/GL/glu.h 276
gluBeginCurve = platform.createBaseFunction(
    'gluBeginCurve',
    dll=platform.PLATFORM.GLU,
    resultType=None,
    argTypes=[POINTER(GLUnurbs)],
    doc='gluBeginCurve( POINTER(GLUnurbs)(nurb) ) -> None',
    argNames=('nurb', ),
)

# /usr/include/GL/glu.h 277
gluBeginPolygon = platform.createBaseFunction(
    'gluBeginPolygon',
    dll=platform.PLATFORM.GLU,
    resultType=None,
    argTypes=[POINTER(GLUtesselator)],
    doc='gluBeginPolygon( POINTER(GLUtesselator)(tess) ) -> None',
    argNames=('tess', ),
)

# /usr/include/GL/glu.h 278
Exemplo n.º 10
0
GLX_HYPERPIPE_PIXEL_AVERAGE_SGIX = constant.Constant( 'GLX_HYPERPIPE_PIXEL_AVERAGE_SGIX', 4 )
GLX_HYPERPIPE_ID_SGIX = constant.Constant( 'GLX_HYPERPIPE_ID_SGIX', 32816 )
# MESA_agp_offset (GL/glxext.h:307)
# ARB_get_proc_address (GL/glxext.h:313)
# SGIX_video_source (GL/glxext.h:317)
# SGIX_fbconfig (GL/glxext.h:321)
# SGIX_pbuffer (GL/glxext.h:326)
# VERSION_1_3 (GL/glxext.h:358)
# VERSION_1_4 (GL/glxext.h:400)
# ARB_get_proc_address (GL/glxext.h:408)
GLX_ARB_get_proc_address = constant.Constant( 'GLX_ARB_get_proc_address', 1 )
__GLXextFuncPtr = CFUNCTYPE(None) 	# GL/glxext.h:314
GLubyte = c_ubyte 	# /usr/include/GL/gl.h:154
glXGetProcAddressARB = platform.createBaseFunction(
    'glXGetProcAddressARB', dll=platform.GL, resultType=__GLXextFuncPtr, 
    argTypes=[POINTER(GLubyte)],
    doc='glXGetProcAddressARB( POINTER(GLubyte)() ) -> __GLXextFuncPtr', 
    argNames=[''],
)

# ARB_multisample (GL/glxext.h:416)
GLX_ARB_multisample = constant.Constant( 'GLX_ARB_multisample', 1 )
# ARB_fbconfig_float (GL/glxext.h:420)
GLX_ARB_fbconfig_float = constant.Constant( 'GLX_ARB_fbconfig_float', 1 )
# SGIS_multisample (GL/glxext.h:424)
GLX_SGIS_multisample = constant.Constant( 'GLX_SGIS_multisample', 1 )
# EXT_visual_info (GL/glxext.h:428)
GLX_EXT_visual_info = constant.Constant( 'GLX_EXT_visual_info', 1 )
# SGI_swap_control (GL/glxext.h:432)
GLX_SGI_swap_control = constant.Constant( 'GLX_SGI_swap_control', 1 )
glXSwapIntervalSGI = platform.createBaseFunction(
    'glXSwapIntervalSGI', dll=platform.GL, resultType=c_int, 
Exemplo n.º 11
0
GLUT_CORE_PROFILE=0x0001
GLUT_DIRECT_RENDERING=0x01
GLUT_FORCE_DIRECT_CONTEXT=3
GLUT_FORCE_INDIRECT_CONTEXT=0
GLUT_FULL_SCREEN=0x01
GLUT_INIT_PROFILE=0x0203
GLUT_KEY_BEGIN=0x006
GLUT_KEY_DELETE=0x006
GLUT_KEY_NUM_LOCK=0x006
GLUT_SRGB=0x1000
GLUT_TRY_DIRECT_CONTEXT=2

# /usr/include/GL/freeglut_ext.h 63
glutMainLoopEvent = platform.createBaseFunction( 
    'glutMainLoopEvent', dll=platform.GLUT, resultType=None, 
    argTypes=[],
    doc='glutMainLoopEvent(  ) -> None', 
    argNames=(),
)
# /usr/include/GL/freeglut_ext.h 64
glutLeaveMainLoop = platform.createBaseFunction( 
    'glutLeaveMainLoop', dll=platform.GLUT, resultType=None, 
    argTypes=[],
    doc='glutLeaveMainLoop(  ) -> None', 
    argNames=(),
)

# /usr/include/GL/freeglut_ext.h 69
##glutMouseWheelFunc = platform.createBaseFunction( 
##	'glutMouseWheelFunc', dll=platform.GLUT, resultType=None, 
##	argTypes=[FUNCTION_TYPE(None, c_int, c_int, c_int, c_int)],
##	doc='glutMouseWheelFunc( FUNCTION_TYPE(None, c_int, c_int, c_int, c_int)(callback) ) -> None', 
Exemplo n.º 12
0

struct__XDisplay._fields_ = [("_opaque_struct", c_int)]


class struct__XDisplay(Structure):
    __slots__ = []


struct__XDisplay._fields_ = [("_opaque_struct", c_int)]

Display = struct__XDisplay  # /usr/include/X11/Xlib.h:495
glXChooseVisual = platform.createBaseFunction(
    "glXChooseVisual",
    dll=platform.GL,
    resultType=POINTER(XVisualInfo),
    argTypes=[POINTER(Display), c_int, POINTER(c_int)],
    doc="glXChooseVisual( POINTER(Display)(dpy), c_int(screen), POINTER(c_int)(attribList) ) -> POINTER(XVisualInfo)",
    argNames=["dpy", "screen", "attribList"],
)

glXCreateContext = platform.createBaseFunction(
    "glXCreateContext",
    dll=platform.GL,
    resultType=GLXContext,
    argTypes=[POINTER(Display), POINTER(XVisualInfo), GLXContext, c_int],
    doc="glXCreateContext( POINTER(Display)(dpy), POINTER(XVisualInfo)(vis), GLXContext(shareList), c_int(direct) ) -> GLXContext",
    argNames=["dpy", "vis", "shareList", "direct"],
)

glXDestroyContext = platform.createBaseFunction(
    "glXDestroyContext",
Exemplo n.º 13
0
from OpenGL import platform, arrays
from OpenGL.constant import Constant
from OpenGL import constants as GLconstants
GLvoid = GLconstants.GLvoid




gleDouble = c_double
gleAffine = gleDouble * 3 * 2


# /usr/include/GL/gle.h 136
gleExtrusion = platform.createBaseFunction( 
	'gleExtrusion', dll=platform.GLE, resultType=None, 
	argTypes=[c_int,arrays.GLdoubleArray,arrays.GLdoubleArray,arrays.GLdoubleArray,c_int,arrays.GLdoubleArray,arrays.GLfloatArray],
	doc='gleExtrusion( c_int(ncp), arrays.GLdoubleArray(contour), arrays.GLdoubleArray(cont_normal), arrays.GLdoubleArray(up), c_int(npoints), arrays.GLdoubleArray(point_array), arrays.GLfloatArray(color_array) ) -> None', 
	argNames=('ncp', 'contour', 'cont_normal', 'up', 'npoints', 'point_array', 'color_array'),
)


# /usr/include/GL/gle.h 110
gleGetJoinStyle = platform.createBaseFunction( 
	'gleGetJoinStyle', dll=platform.GLE, resultType=c_int, 
	argTypes=[],
	doc='gleGetJoinStyle(  ) -> c_int', 
	argNames=(),
)


# /usr/include/GL/gle.h 114
gleGetNumSides = platform.createBaseFunction( 
Exemplo n.º 14
0
    ]
struct__XDisplay._fields_ = [
    ('_opaque_struct', c_int)
]

class struct__XDisplay(Structure):
    __slots__ = [
    ]
struct__XDisplay._fields_ = [
    ('_opaque_struct', c_int)
]

Display = struct__XDisplay 	# /usr/include/X11/Xlib.h:519
glXChooseVisual = platform.createBaseFunction(
    'glXChooseVisual', dll=platform.GL, resultType=POINTER(XVisualInfo), 
    argTypes=[POINTER(Display), c_int, POINTER(c_int)],
    doc='glXChooseVisual( POINTER(Display)(dpy), c_int(screen), POINTER(c_int)(attribList) ) -> POINTER(XVisualInfo)', 
    argNames=['dpy', 'screen', 'attribList'],
)

glXCreateContext = platform.createBaseFunction(
    'glXCreateContext', dll=platform.GL, resultType=GLXContext, 
    argTypes=[POINTER(Display), POINTER(XVisualInfo), GLXContext, c_int],
    doc='glXCreateContext( POINTER(Display)(dpy), POINTER(XVisualInfo)(vis), GLXContext(shareList), c_int(direct) ) -> GLXContext', 
    argNames=['dpy', 'vis', 'shareList', 'direct'],
)

glXDestroyContext = platform.createBaseFunction(
    'glXDestroyContext', dll=platform.GL, resultType=None, 
    argTypes=[POINTER(Display), GLXContext],
    doc='glXDestroyContext( POINTER(Display)(dpy), GLXContext(ctx) ) -> None', 
    argNames=['dpy', 'ctx'],
Exemplo n.º 15
0
"""OSX specific extensions to GLUT"""
from OpenGL import platform
from OpenGL import constant
from OpenGL.GLUT import special

GLUT_NO_RECOVERY = constant.Constant("GLUT_NO_RECOVERY", 1024)
GLUT_3_2_CORE_PROFILE = constant.Constant("GLUT_3_2_CORE_PROFILE", 2048)

glutCheckLoop = platform.createBaseFunction(
    "glutCheckLoop",
    dll=platform.PLATFORM.GLUT,
    resultType=None,
    argTypes=[],
    doc="glutCheckLoop() -> None",
    argNames=(),
)

glutWMCloseFunc = special.GLUTCallback(
    "WMClose",
    (),
    (),
)
Exemplo n.º 16
0
        if not isinstance( function, callbackType ):
            cCallback = callbackType( function )
        else:
            cCallback = function
        GLU.gluQuadricCallback( self, which, cCallback )
        # XXX catch errors!
        if getattr( self, 'callbacks', None ) is None:
            self.callbacks = {}
        self.callbacks[ which ] = cCallback
        return cCallback
GLUquadric = GLUQuadric

def gluQuadricCallback( quadric, which=simple.GLU_ERROR, function=None ):
    """Set the GLU error callback function"""
    return quadric.addCallback( which, function )

# Override to produce instances of the sub-class...
gluNewQuadric = createBaseFunction( 
    'gluNewQuadric', dll=GLU, resultType=ctypes.POINTER(GLUQuadric), 
    argTypes=[],
    doc="""gluNewQuadric(  ) -> GLUQuadric
    
Create a new GLUQuadric object""", 
    argNames=[],
)

__all__ = (
    'gluNewQuadric',
    'gluQuadricCallback',
    'GLUQuadric',
)
GLUT_CORE_PROFILE=0x0001
GLUT_DIRECT_RENDERING=0x01
GLUT_FORCE_DIRECT_CONTEXT=3
GLUT_FORCE_INDIRECT_CONTEXT=0
GLUT_FULL_SCREEN=0x01
GLUT_INIT_PROFILE=0x0203
GLUT_KEY_BEGIN=0x006
GLUT_KEY_DELETE=0x006
GLUT_KEY_NUM_LOCK=0x006
GLUT_SRGB=0x1000
GLUT_TRY_DIRECT_CONTEXT=2

# /usr/include/GL/freeglut_ext.h 63
glutMainLoopEvent = platform.createBaseFunction( 
    'glutMainLoopEvent', dll=platform.PLATFORM.GLUT, resultType=None, 
    argTypes=[],
    doc='glutMainLoopEvent(  ) -> None', 
    argNames=(),
)
# /usr/include/GL/freeglut_ext.h 64
glutLeaveMainLoop = platform.createBaseFunction( 
    'glutLeaveMainLoop', dll=platform.PLATFORM.GLUT, resultType=None, 
    argTypes=[],
    doc='glutLeaveMainLoop(  ) -> None', 
    argNames=(),
)

# /usr/include/GL/freeglut_ext.h 69
##glutMouseWheelFunc = platform.createBaseFunction( 
##	'glutMouseWheelFunc', dll=platform.PLATFORM.GLUT, resultType=None, 
##	argTypes=[FUNCTION_TYPE(None, c_int, c_int, c_int, c_int)],
##	doc='glutMouseWheelFunc( FUNCTION_TYPE(None, c_int, c_int, c_int, c_int)(callback) ) -> None', 
Exemplo n.º 18
0
        platform.PLATFORM.GLUT)


class STRING(c_char_p):
    @classmethod
    def from_param(cls, value):
        if isinstance(value, unicode):
            value = value.encode("utf-8")
        return c_char_p.from_param(value)


# /usr/include/GL/freeglut_std.h 445
glutAddMenuEntry = platform.createBaseFunction(
    "glutAddMenuEntry",
    dll=platform.PLATFORM.GLUT,
    resultType=None,
    argTypes=[STRING, c_int],
    doc="glutAddMenuEntry(STRING(label), c_int(value)) -> None",
    argNames=("label", "value"),
)

# /usr/include/GL/freeglut_std.h 446
glutAddSubMenu = platform.createBaseFunction(
    "glutAddSubMenu",
    dll=platform.PLATFORM.GLUT,
    resultType=None,
    argTypes=[STRING, c_int],
    doc="glutAddSubMenu(STRING(label), c_int(subMenu)) -> None",
    argNames=("label", "subMenu"),
)

# /usr/include/GL/freeglut_std.h 450
Exemplo n.º 19
0
"""This handles the absence of gleSetNumSlices and gleGetNumSlices on macs that
   use an older version of OpenGL.
"""
from ctypes import c_int
from OpenGL import platform
from OpenGL.GLE import gleGetNumSides, gleSetNumSides

if not bool(gleGetNumSides):
    # If no getnumsides, try mapping to the older gleGetNumSlices
    gleGetNumSides = platform.createBaseFunction(
        'gleGetNumSlices',
        dll=platform.GLE,
        resultType=c_int,
        argTypes=[],
        doc='gleGetNumSlices(  ) -> c_int',
        argNames=())

    gleSetNumSides = platform.createBaseFunction(
        'gleSetNumSlices',
        dll=platform.GLE,
        resultType=None,
        argTypes=[c_int],
        doc='gleSetNumSlices( c_int(slices) ) -> None',
        argNames=('slices', ))

    try:
        gleGetNumSides()
    except:
        # Set to no-ops if nothing actually ends up working.
        gleGetNumSides = int
        gleSetNumSides = int
Exemplo n.º 20
0
GLUT_CORE_PROFILE=0x0001
GLUT_DIRECT_RENDERING=0x01
GLUT_FORCE_DIRECT_CONTEXT=3
GLUT_FORCE_INDIRECT_CONTEXT=0
GLUT_FULL_SCREEN=0x01
GLUT_INIT_PROFILE=0x0203
GLUT_KEY_BEGIN=0x006
GLUT_KEY_DELETE=0x006
GLUT_KEY_NUM_LOCK=0x006
GLUT_SRGB=0x1000
GLUT_TRY_DIRECT_CONTEXT=2

# /usr/include/GL/freeglut_ext.h 63
glutMainLoopEvent = platform.createBaseFunction( 
    'glutMainLoopEvent', dll=platform.PLATFORM.GLUT, resultType=None, 
    argTypes=[],
    doc='glutMainLoopEvent(  ) -> None', 
    argNames=(),
)
# /usr/include/GL/freeglut_ext.h 64
glutLeaveMainLoop = platform.createBaseFunction( 
    'glutLeaveMainLoop', dll=platform.PLATFORM.GLUT, resultType=None, 
    argTypes=[],
    doc='glutLeaveMainLoop(  ) -> None', 
    argNames=(),
)

# /usr/include/GL/freeglut_ext.h 69
##glutMouseWheelFunc = platform.createBaseFunction( 
##	'glutMouseWheelFunc', dll=platform.PLATFORM.GLUT, resultType=None, 
##	argTypes=[FUNCTION_TYPE(None, c_int, c_int, c_int, c_int)],
##	doc='glutMouseWheelFunc( FUNCTION_TYPE(None, c_int, c_int, c_int, c_int)(callback) ) -> None', 
Exemplo n.º 21
0
LONG = c_long 	# /home/mcfletch/pylive/OpenGL-ctypes/src/wgl.h:55
DWORD = c_ulong 	# /home/mcfletch/pylive/OpenGL-ctypes/src/wgl.h:56
FLOAT = c_float 	# /home/mcfletch/pylive/OpenGL-ctypes/src/wgl.h:57
COLORREF = DWORD 	# /home/mcfletch/pylive/OpenGL-ctypes/src/wgl.h:58
LPCOLORREF = POINTER(DWORD) 	# /home/mcfletch/pylive/OpenGL-ctypes/src/wgl.h:58

HANDLE = POINTER(None) 	# /home/mcfletch/pylive/OpenGL-ctypes/src/wgl.h:60
# TODO: figure out how to make the handle not appear as a void_p within the code...
HANDLE.final = True

HGLRC = HANDLE 	# /home/mcfletch/pylive/OpenGL-ctypes/src/wgl.h:62
HDC = HANDLE 	# /home/mcfletch/pylive/OpenGL-ctypes/src/wgl.h:63
PROC = CFUNCTYPE(INT_PTR) 	# /home/mcfletch/pylive/OpenGL-ctypes/src/wgl.h:65
wglCopyContext = platform.createBaseFunction(
    'wglCopyContext', dll=platform.GL, resultType=BOOL, 
    argTypes=[HGLRC, HGLRC, UINT],
    doc='wglCopyContext( HGLRC(None), HGLRC(None), UINT(None) ) -> BOOL', 
    argNames=['None', 'None', 'None'],
)

wglCreateContext = platform.createBaseFunction(
    'wglCreateContext', dll=platform.GL, resultType=HGLRC, 
    argTypes=[HDC],
    doc='wglCreateContext( HDC(None) ) -> HGLRC', 
    argNames=['None'],
)

wglCreateLayerContext = platform.createBaseFunction(
    'wglCreateLayerContext', dll=platform.GL, resultType=HGLRC, 
    argTypes=[HDC, c_int],
    doc='wglCreateLayerContext( HDC(None), c_int(None) ) -> HGLRC', 
    argNames=['None', 'None'],
Exemplo n.º 22
0
from OpenGL import contextdata, error, platform, logs
from OpenGL.raw import GLUT as _simple
from OpenGL._bytes import bytes, unicode,as_8_bit
import ctypes, os, sys, traceback
PLATFORM = platform.PLATFORM
FUNCTION_TYPE = _simple.CALLBACK_FUNCTION_TYPE
from OpenGL._bytes import long, integer_types

_log = logs.getLog("OpenGL.GLUT.special")

if os.name == "nt":
    _log.info("""Using NT-specific GLUT calls with exit callbacks""")
    _exitfunctype = FUNCTION_TYPE(None, ctypes.c_int)
    __glutInitWithExit = platform.createBaseFunction(
        "__glutInitWithExit", dll=platform.PLATFORM.GLUT, resultType=None,
        argTypes=[ctypes.POINTER(ctypes.c_int),ctypes.POINTER(ctypes.c_char_p),_exitfunctype],
        doc="glutInit(POINTER(c_int)(pargc), POINTER(STRING)(argv)) -> None",
        argNames=("pargc", "argv"),
   )
    __glutCreateWindowWithExit = platform.createBaseFunction(
        "__glutCreateWindowWithExit", dll=platform.PLATFORM.GLUT, resultType=ctypes.c_int,
        argTypes=[ctypes.c_char_p,_exitfunctype],
        doc="glutCreateWindow(STRING(title)) -> c_int",
        argNames=("title",),
   )
    __glutCreateMenuWithExit = platform.createBaseFunction(
        "__glutCreateMenuWithExit", dll=platform.PLATFORM.GLUT, resultType=ctypes.c_int, 
        argTypes=[FUNCTION_TYPE(None, ctypes.c_int),_exitfunctype],
        doc="glutCreateMenu(FUNCTION_TYPE(None, c_int)(callback)) -> c_int", 
        argNames=("callback",),
   )
else:
Exemplo n.º 23
0
    # /usr/include/GL/glu.h 258
]
GLUquadricObj = GLUquadric
class GLUtesselator(Structure):
    pass
GLUtesselator._fields_ = [
    # /usr/include/GL/glu.h 259
]
GLUtesselatorObj = GLUtesselator
GLUtriangulatorObj = GLUtesselator


# /usr/include/GL/glu.h 276
gluBeginCurve = platform.createBaseFunction( 
    'gluBeginCurve', dll=platform.PLATFORM.GLU, resultType=None, 
    argTypes=[POINTER(GLUnurbs)],
    doc='gluBeginCurve( POINTER(GLUnurbs)(nurb) ) -> None', 
    argNames=('nurb',),
)


# /usr/include/GL/glu.h 277
gluBeginPolygon = platform.createBaseFunction( 
    'gluBeginPolygon', dll=platform.PLATFORM.GLU, resultType=None, 
    argTypes=[POINTER(GLUtesselator)],
    doc='gluBeginPolygon( POINTER(GLUtesselator)(tess) ) -> None', 
    argNames=('tess',),
)


# /usr/include/GL/glu.h 278
gluBeginSurface = platform.createBaseFunction( 
Exemplo n.º 24
0
            vertex = self.originalObject(vertex)
            try:
                if data is not None:
                    data = self.originalObject(data)
                    return function( vertex, data )
                else:
                    return function( vertex )
            except Exception as err:
                err.args += (function,(vertex,data))
                raise
        return wrap

GLUtesselator.CALLBACK_FUNCTION_REGISTRARS = dict([
    (c,createBaseFunction(
        'gluTessCallback', dll=GLU, resultType=None,
        argTypes=[ctypes.POINTER(GLUtesselator), _simple.GLenum,funcType],
        doc='gluTessCallback( POINTER(GLUtesselator)(tess), GLenum(which), _GLUfuncptr(CallBackFunc) ) -> None',
        argNames=('tess', 'which', 'CallBackFunc'),
    ))
    for (c,funcType) in GLUtesselator.CALLBACK_TYPES.items()
])
try:
    del c, funcType
except NameError as err:
    pass

def gluTessCallback( tess, which, function ):
    """Set a given gluTessellator callback for the given tessellator"""
    return tess.addCallback( which, function )
def gluTessBeginPolygon( tess, data ):
    """Start definition of polygon in the tessellator"""
    return tess.gluTessBeginPolygon( data )
Exemplo n.º 25
0

# GLUT init
# --------------------------------------
glut.glutInit(sys.argv)
# HiDPI support for retina display
# This requires glut from http://iihm.imag.fr/blanch/software/glut-macosx/
if sys.platform == "darwin":
    import ctypes
    from OpenGL import platform

    try:
        glutInitDisplayString = platform.createBaseFunction(
            "glutInitDisplayString",
            dll=platform.GLUT,
            resultType=None,
            argTypes=[ctypes.c_char_p],
            doc="glutInitDisplayString(  ) -> None",
            argNames=(),
        )
        # text = ctypes.c_char_p("rgba stencil double samples=8 hidpi")
        text = ctypes.c_char_p("rgba double hidpi")
        glutInitDisplayString(text)
    except:
        pass
glut.glutInitDisplayMode(glut.GLUT_DOUBLE | glut.GLUT_RGBA)
glut.glutCreateWindow("Antialiased lines using fragment shader")
glut.glutReshapeWindow(800, 800)
glut.glutReshapeFunc(reshape)
glut.glutDisplayFunc(display)
glut.glutKeyboardFunc(keyboard)
Exemplo n.º 26
0
from OpenGL import platform, arrays
from OpenGL.constant import Constant
from OpenGL.raw.GL import _types as GL_types
GLvoid = GL_types.GLvoid

gleDouble = c_double
gleAffine = gleDouble * 3 * 2

# /usr/include/GL/gle.h 136
gleExtrusion = platform.createBaseFunction(
    "gleExtrusion",
    dll=platform.PLATFORM.GLE,
    resultType=None,
    argTypes=[
        c_int, arrays.GLdoubleArray, arrays.GLdoubleArray,
        arrays.GLdoubleArray, c_int, arrays.GLdoubleArray, arrays.GLfloatArray
    ],
    doc=
    "gleExtrusion(c_int(ncp), arrays.GLdoubleArray(contour), arrays.GLdoubleArray(cont_normal), arrays.GLdoubleArray(up), c_int(npoints), arrays.GLdoubleArray(point_array), arrays.GLfloatArray(color_array)) -> None",
    argNames=("ncp", "contour", "cont_normal", "up", "npoints", "point_array",
              "color_array"),
)

# /usr/include/GL/gle.h 110
gleGetJoinStyle = platform.createBaseFunction(
    "gleGetJoinStyle",
    dll=platform.PLATFORM.GLE,
    resultType=c_int,
    argTypes=[],
    doc="gleGetJoinStyle() -> c_int",
    argNames=(),
Exemplo n.º 27
0
GLX_AUX8_EXT = constant.Constant( 'GLX_AUX8_EXT', 8426 )
GLX_AUX9_EXT = constant.Constant( 'GLX_AUX9_EXT', 8427 )
# ARB_get_proc_address (GL/glxext.h:373)
# ARB_multisample (GL/glxext.h:377)
GLX_ARB_multisample = constant.Constant( 'GLX_ARB_multisample', 1 )
# ARB_fbconfig_float (GL/glxext.h:381)
GLX_ARB_fbconfig_float = constant.Constant( 'GLX_ARB_fbconfig_float', 1 )
# SGIS_multisample (GL/glxext.h:385)
GLX_SGIS_multisample = constant.Constant( 'GLX_SGIS_multisample', 1 )
# EXT_visual_info (GL/glxext.h:389)
GLX_EXT_visual_info = constant.Constant( 'GLX_EXT_visual_info', 1 )
# SGI_swap_control (GL/glxext.h:393)
GLX_SGI_swap_control = constant.Constant( 'GLX_SGI_swap_control', 1 )
glXSwapIntervalSGI = platform.createBaseFunction(
	'glXSwapIntervalSGI', dll=platform.GL, resultType=c_int, 
	argTypes=[c_int],
	doc='glXSwapIntervalSGI( c_int(None) ) -> c_int', 
	argNames=['None'],
)

# SGI_video_sync (GL/glxext.h:401)
GLX_SGI_video_sync = constant.Constant( 'GLX_SGI_video_sync', 1 )
glXGetVideoSyncSGI = platform.createBaseFunction(
	'glXGetVideoSyncSGI', dll=platform.GL, resultType=c_int, 
	argTypes=[POINTER(c_uint)],
	doc='glXGetVideoSyncSGI( POINTER(c_uint)() ) -> c_int', 
	argNames=[''],
)

glXWaitVideoSyncSGI = platform.createBaseFunction(
	'glXWaitVideoSyncSGI', dll=platform.GL, resultType=c_int, 
	argTypes=[c_int, c_int, POINTER(c_uint)],
Exemplo n.º 28
0
INT = c_int  # /home/mcfletch/pylive/OpenGL-ctypes/src/wgl.h:53
INT_PTR = POINTER(c_int)  # /home/mcfletch/pylive/OpenGL-ctypes/src/wgl.h:53
BOOL = c_long  # /home/mcfletch/pylive/OpenGL-ctypes/src/wgl.h:54
LONG = c_long  # /home/mcfletch/pylive/OpenGL-ctypes/src/wgl.h:55
DWORD = c_ulong  # /home/mcfletch/pylive/OpenGL-ctypes/src/wgl.h:56
FLOAT = c_float  # /home/mcfletch/pylive/OpenGL-ctypes/src/wgl.h:57
COLORREF = DWORD  # /home/mcfletch/pylive/OpenGL-ctypes/src/wgl.h:58
LPCOLORREF = POINTER(DWORD)  # /home/mcfletch/pylive/OpenGL-ctypes/src/wgl.h:58
HANDLE = POINTER(None)  # /home/mcfletch/pylive/OpenGL-ctypes/src/wgl.h:60
HGLRC = HANDLE  # /home/mcfletch/pylive/OpenGL-ctypes/src/wgl.h:62
HDC = HANDLE  # /home/mcfletch/pylive/OpenGL-ctypes/src/wgl.h:63
PROC = CFUNCTYPE(INT_PTR)  # /home/mcfletch/pylive/OpenGL-ctypes/src/wgl.h:65
wglCopyContext = platform.createBaseFunction(
    'wglCopyContext',
    dll=platform.GL,
    resultType=BOOL,
    argTypes=[HGLRC, HGLRC, UINT],
    doc='wglCopyContext( HGLRC(None), HGLRC(None), UINT(None) ) -> BOOL',
    argNames=['None', 'None', 'None'],
)

wglCreateContext = platform.createBaseFunction(
    'wglCreateContext',
    dll=platform.GL,
    resultType=HGLRC,
    argTypes=[HDC],
    doc='wglCreateContext( HDC(None) ) -> HGLRC',
    argNames=['None'],
)

wglCreateLayerContext = platform.createBaseFunction(
    'wglCreateLayerContext',
Exemplo n.º 29
0
    linewidth = args.linewidth
    antialias = 1.0
    linecount = args.linecount
    color = (0,0,0,1)
    np.random.seed(1)

    glut.glutInit(sys.argv)
    # HiDPI support for retina display
    # This requires glut from http://iihm.imag.fr/blanch/software/glut-macosx/
    if sys.platform == 'darwin':
        import ctypes
        from OpenGL import platform
        try:
            glutInitDisplayString = platform.createBaseFunction( 
                'glutInitDisplayString', dll=platform.GLUT, resultType=None, 
                argTypes=[ctypes.c_char_p],
                doc='glutInitDisplayString(  ) -> None', 
            argNames=() )
            text = ctypes.c_char_p("rgba stencil double samples=8 hidpi")
            glutInitDisplayString(text)
        except:
            pass

    glut.glutInitDisplayMode(glut.GLUT_DOUBLE | glut.GLUT_RGB)
    glut.glutInitWindowSize(width, height)
    glut.glutCreateWindow("Benchmark")
    glut.glutDisplayFunc(on_display)
    glut.glutReshapeFunc(on_reshape)
    glut.glutIdleFunc(on_idle)

    # Some init
Exemplo n.º 30
0
# VERSION_1_3 (GL/glxext.h:358)
# VERSION_1_4 (GL/glxext.h:400)
# ARB_get_proc_address (GL/glxext.h:408)
# ARB_multisample (GL/glxext.h:416)
GLX_ARB_multisample = constant.Constant( 'GLX_ARB_multisample', 1 )
# ARB_fbconfig_float (GL/glxext.h:420)
GLX_ARB_fbconfig_float = constant.Constant( 'GLX_ARB_fbconfig_float', 1 )
# SGIS_multisample (GL/glxext.h:424)
GLX_SGIS_multisample = constant.Constant( 'GLX_SGIS_multisample', 1 )
# EXT_visual_info (GL/glxext.h:428)
GLX_EXT_visual_info = constant.Constant( 'GLX_EXT_visual_info', 1 )
# SGI_swap_control (GL/glxext.h:432)
GLX_SGI_swap_control = constant.Constant( 'GLX_SGI_swap_control', 1 )
glXSwapIntervalSGI = platform.createBaseFunction(
    'glXSwapIntervalSGI', dll=platform.GL, resultType=c_int,
    argTypes=[c_int],
    doc='glXSwapIntervalSGI( c_int(None) ) -> c_int',
    argNames=['None'],
)

# SGI_video_sync (GL/glxext.h:440)
GLX_SGI_video_sync = constant.Constant( 'GLX_SGI_video_sync', 1 )
glXGetVideoSyncSGI = platform.createBaseFunction(
    'glXGetVideoSyncSGI', dll=platform.GL, resultType=c_int,
    argTypes=[POINTER(c_uint)],
    doc='glXGetVideoSyncSGI( POINTER(c_uint)() ) -> c_int',
    argNames=[''],
)

glXWaitVideoSyncSGI = platform.createBaseFunction(
    'glXWaitVideoSyncSGI', dll=platform.GL, resultType=c_int,
    argTypes=[c_int, c_int, POINTER(c_uint)],
Exemplo n.º 31
0
else:
    CALLBACK_FUNCTION_TYPE = platform.PLATFORM.functionTypeFor( platform.GLUT )

STRING = c_char_p
from OpenGL.constants import GLenum
from OpenGL.constants import GLfloat
from OpenGL.constants import GLdouble
from OpenGL.constants import GLint




# /usr/include/GL/freeglut_std.h 445
glutAddMenuEntry = platform.createBaseFunction( 
    'glutAddMenuEntry', dll=platform.GLUT, resultType=None, 
    argTypes=[STRING,c_int],
    doc='glutAddMenuEntry( STRING(label), c_int(value) ) -> None', 
    argNames=('label', 'value'),
)


# /usr/include/GL/freeglut_std.h 446
glutAddSubMenu = platform.createBaseFunction( 
    'glutAddSubMenu', dll=platform.GLUT, resultType=None, 
    argTypes=[STRING,c_int],
    doc='glutAddSubMenu( STRING(label), c_int(subMenu) ) -> None', 
    argNames=('label', 'subMenu'),
)


# /usr/include/GL/freeglut_std.h 450
glutAttachMenu = platform.createBaseFunction( 
Exemplo n.º 32
0
GLUT_USE_CURRENT_CONTEXT = constant.Constant('GLUT_USE_CURRENT_CONTEXT', 1)

GLUT_ACTION_ON_WINDOW_CLOSE = constant.Constant('GLUT_ACTION_ON_WINDOW_CLOSE',
                                                0x01F9)
GLUT_WINDOW_BORDER_WIDTH = constant.Constant('GLUT_WINDOW_BORDER_WIDTH',
                                             0x01FA)
GLUT_WINDOW_HEADER_HEIGHT = constant.Constant('GLUT_USE_CURRENT_CONTEXT',
                                              0x01FB)
#GLUT_VERSION = constant.Constant( 'GLUT_VERSION', 0x01FC )
GLUT_RENDERING_CONTEXT = constant.Constant('GLUT_RENDERING_CONTEXT', 0x01FD)

# /usr/include/GL/freeglut_ext.h 63
glutMainLoopEvent = platform.createBaseFunction(
    'glutMainLoopEvent',
    dll=platform.GLUT,
    resultType=None,
    argTypes=[],
    doc='glutMainLoopEvent(  ) -> None',
    argNames=(),
)
# /usr/include/GL/freeglut_ext.h 64
glutLeaveMainLoop = platform.createBaseFunction(
    'glutLeaveMainLoop',
    dll=platform.GLUT,
    resultType=None,
    argTypes=[],
    doc='glutLeaveMainLoop(  ) -> None',
    argNames=(),
)

# /usr/include/GL/freeglut_ext.h 69
##glutMouseWheelFunc = platform.createBaseFunction(
Exemplo n.º 33
0
    global __initialized__
    # Not an error, we cannot really terminate glut
    __initialized__ = True


# ------------------------------------------------------------ availability ---
try:
    import sys
    import OpenGL.GLUT as glut
    if sys.platform == 'darwin':
        import OpenGL.platform as platform
        try:
            glutCheckLoop = platform.createBaseFunction(
                'glutCheckLoop',
                dll=platform.GLUT,
                resultType=None,
                argTypes=[],
                doc='glutCheckLoop( ) -> None',
                argNames=(),
            )
        except AttributeError:
            __availability__ = False
            __version__ = None
        __availability__ = True
        __version__ = "%d" % glut.GLUT_API_VERSION
        __init__()

        __mouse_map__ = {
            glut.GLUT_LEFT_BUTTON: window.mouse.LEFT,
            glut.GLUT_MIDDLE_BUTTON: window.mouse.MIDDLE,
            glut.GLUT_RIGHT_BUTTON: window.mouse.RIGHT
        }
Exemplo n.º 34
0
                else:
                    return function(vertex)
            except Exception as err:
                err.args += (function, (vertex, data))
                raise

        return wrap


GLUtesselator.CALLBACK_FUNCTION_REGISTRARS = dict([(
    c,
    createBaseFunction(
        'gluTessCallback',
        dll=GLU,
        resultType=None,
        argTypes=[ctypes.POINTER(GLUtesselator), _simple.GLenum, funcType],
        doc=
        'gluTessCallback( POINTER(GLUtesselator)(tess), GLenum(which), _GLUfuncptr(CallBackFunc) ) -> None',
        argNames=('tess', 'which', 'CallBackFunc'),
    )) for (c, funcType) in GLUtesselator.CALLBACK_TYPES.items()])
try:
    del c, funcType
except NameError as err:
    pass


def gluTessCallback(tess, which, function):
    """Set a given gluTessellator callback for the given tessellator"""
    return tess.addCallback(which, function)

Exemplo n.º 35
0
struct__XDisplay._fields_ = [('_opaque_struct', c_int)]


class struct__XDisplay(Structure):
    __slots__ = []


struct__XDisplay._fields_ = [('_opaque_struct', c_int)]

Display = struct__XDisplay  # /usr/include/X11/Xlib.h:519
glXChooseVisual = platform.createBaseFunction(
    'glXChooseVisual',
    dll=platform.GL,
    resultType=POINTER(XVisualInfo),
    argTypes=[POINTER(Display), c_int, POINTER(c_int)],
    doc=
    'glXChooseVisual( POINTER(Display)(dpy), c_int(screen), POINTER(c_int)(attribList) ) -> POINTER(XVisualInfo)',
    argNames=['dpy', 'screen', 'attribList'],
)

glXCreateContext = platform.createBaseFunction(
    'glXCreateContext',
    dll=platform.GL,
    resultType=GLXContext,
    argTypes=[POINTER(Display),
              POINTER(XVisualInfo), GLXContext, c_int],
    doc=
    'glXCreateContext( POINTER(Display)(dpy), POINTER(XVisualInfo)(vis), GLXContext(shareList), c_int(direct) ) -> GLXContext',
    argNames=['dpy', 'vis', 'shareList', 'direct'],
)
Exemplo n.º 36
0
GLX_AUX9_EXT = constant.Constant('GLX_AUX9_EXT', 8427)
# ARB_get_proc_address (GL/glxext.h:373)
# ARB_multisample (GL/glxext.h:377)
GLX_ARB_multisample = constant.Constant('GLX_ARB_multisample', 1)
# ARB_fbconfig_float (GL/glxext.h:381)
GLX_ARB_fbconfig_float = constant.Constant('GLX_ARB_fbconfig_float', 1)
# SGIS_multisample (GL/glxext.h:385)
GLX_SGIS_multisample = constant.Constant('GLX_SGIS_multisample', 1)
# EXT_visual_info (GL/glxext.h:389)
GLX_EXT_visual_info = constant.Constant('GLX_EXT_visual_info', 1)
# SGI_swap_control (GL/glxext.h:393)
GLX_SGI_swap_control = constant.Constant('GLX_SGI_swap_control', 1)
glXSwapIntervalSGI = platform.createBaseFunction(
    'glXSwapIntervalSGI',
    dll=platform.GL,
    resultType=c_int,
    argTypes=[c_int],
    doc='glXSwapIntervalSGI( c_int(None) ) -> c_int',
    argNames=['None'],
)

# SGI_video_sync (GL/glxext.h:401)
GLX_SGI_video_sync = constant.Constant('GLX_SGI_video_sync', 1)
glXGetVideoSyncSGI = platform.createBaseFunction(
    'glXGetVideoSyncSGI',
    dll=platform.GL,
    resultType=c_int,
    argTypes=[POINTER(c_uint)],
    doc='glXGetVideoSyncSGI( POINTER(c_uint)() ) -> c_int',
    argNames=[''],
)
Exemplo n.º 37
0
from OpenGL import platform, arrays
from OpenGL.constant import Constant
from OpenGL import constants as GLconstants
GLvoid = GLconstants.GLvoid

gleDouble = c_double
gleAffine = gleDouble * 3 * 2

# /usr/include/GL/gle.h 136
gleExtrusion = platform.createBaseFunction(
    'gleExtrusion',
    dll=platform.GLE,
    resultType=None,
    argTypes=[
        c_int, arrays.GLdoubleArray, arrays.GLdoubleArray,
        arrays.GLdoubleArray, c_int, arrays.GLdoubleArray, arrays.GLfloatArray
    ],
    doc=
    'gleExtrusion( c_int(ncp), arrays.GLdoubleArray(contour), arrays.GLdoubleArray(cont_normal), arrays.GLdoubleArray(up), c_int(npoints), arrays.GLdoubleArray(point_array), arrays.GLfloatArray(color_array) ) -> None',
    argNames=('ncp', 'contour', 'cont_normal', 'up', 'npoints', 'point_array',
              'color_array'),
)

# /usr/include/GL/gle.h 110
gleGetJoinStyle = platform.createBaseFunction(
    'gleGetJoinStyle',
    dll=platform.GLE,
    resultType=c_int,
    argTypes=[],
    doc='gleGetJoinStyle(  ) -> c_int',
    argNames=(),
Exemplo n.º 38
0
    __initialized__ = True


# ------------------------------------------------------------ availability ---
try:
    import sys
    import OpenGL.GLUT as glut

    if sys.platform == "darwin":
        import OpenGL.platform as platform

        try:
            glutCheckLoop = platform.createBaseFunction(
                "glutCheckLoop",
                dll=platform.GLUT,
                resultType=None,
                argTypes=[],
                doc="glutCheckLoop( ) -> None",
                argNames=(),
            )
        except AttributeError:
            availability = False
            __version__ = None
        availability = True
        __version__ = "%d" % glut.GLUT_API_VERSION
        __init__()

        __mouse_map__ = {
            glut.GLUT_LEFT_BUTTON: window.mouse.LEFT,
            glut.GLUT_MIDDLE_BUTTON: window.mouse.MIDDLE,
            glut.GLUT_RIGHT_BUTTON: window.mouse.RIGHT,
        }
Exemplo n.º 39
0
#
#    Linas Vesptas's GLE Tubing and Extrusion library
#    <http://linas.org/gle/index.html> with documentation and example
#    programs is now a part of GLUT.

# The following was extracted and modified from gle[GS]etNumSides in
#    /Library/Python/2.5/site-packages/PyOpenGL-3.0.0a6-py2.5.egg/
#        OpenGL/raw/GLE/__init__.py
from OpenGL.raw.GLE.constants import *

from ctypes import *
from OpenGL import platform, arrays
from OpenGL.constant import Constant
from OpenGL import constants as GLconstants

# /usr/include/GL/gle.h 114
gleGetNumSides = platform.createBaseFunction(
        'gleGetNumSlices', dll=platform.GLE, resultType=c_int,
        argTypes=[],
        doc='gleGetNumSlices(  ) -> c_int',
        argNames=(),
)

# /usr/include/GL/gle.h 115
gleSetNumSides = platform.createBaseFunction(
        'gleSetNumSlices', dll=platform.GLE, resultType=None,
        argTypes=[c_int],
        doc='gleSetNumSlices( c_int(slices) ) -> None',
        argNames=('slices',),
)
Exemplo n.º 40
0
import ctypes
from OpenGL.raw.GL.VERSION.GL_2_0 import *
### END AUTOGENERATED SECTION
import OpenGL
from OpenGL.raw.GL.ARB.shader_objects import GL_OBJECT_COMPILE_STATUS_ARB as GL_OBJECT_COMPILE_STATUS
from OpenGL.raw.GL.ARB.shader_objects import GL_OBJECT_LINK_STATUS_ARB as GL_OBJECT_LINK_STATUS
from OpenGL.GL.ARB.shader_objects import glGetInfoLogARB as glGetInfoLog
from OpenGL.lazywrapper import lazy

from OpenGL import converters, error
GL_INFO_LOG_LENGTH = constant.Constant( 'GL_INFO_LOG_LENGTH', 0x8B84 )

glShaderSource = platform.createBaseFunction( 
	'glShaderSource', dll=platform.GL,
	resultType=None, 
	argTypes=(constants.GLhandle, constants.GLsizei, ctypes.POINTER(ctypes.c_char_p), arrays.GLintArray,),
	doc = 'glShaderSource( GLhandle(shaderObj), str( string) ) -> None',
	argNames = ('shaderObj', 'count', 'string', 'length',),
)
conv = converters.StringLengths( name='string' )
glShaderSource = wrapper.wrapper(
	glShaderSource
).setPyConverter(
	'count' # number of strings
).setPyConverter( 
	'length' # lengths of strings
).setPyConverter(
	'string', conv.stringArray
).setCResolver(
	'string', conv.stringArrayForC,
).setCConverter(
Exemplo n.º 41
0
    # /usr/include/GL/glu.h 258
]
GLUquadricObj = GLUquadric
class GLUtesselator(Structure):
    pass
GLUtesselator._fields_ = [
    # /usr/include/GL/glu.h 259
]
GLUtesselatorObj = GLUtesselator
GLUtriangulatorObj = GLUtesselator


# /usr/include/GL/glu.h 276
gluBeginCurve = platform.createBaseFunction(
    "gluBeginCurve", dll=platform.PLATFORM.GLU, resultType=None, 
    argTypes=[POINTER(GLUnurbs)],
    doc="gluBeginCurve(POINTER(GLUnurbs)(nurb)) -> None", 
    argNames=("nurb",),
)


# /usr/include/GL/glu.h 277
gluBeginPolygon = platform.createBaseFunction(
    "gluBeginPolygon", dll=platform.PLATFORM.GLU, resultType=None, 
    argTypes=[POINTER(GLUtesselator)],
    doc="gluBeginPolygon(POINTER(GLUtesselator)(tess)) -> None", 
    argNames=("tess",),
)


# /usr/include/GL/glu.h 278
gluBeginSurface = platform.createBaseFunction(