示例#1
0
def glGetMinmax(baseFunction, target, reset, format, type, values=None):
    """Retrieve minimum and maximum values as a 2-element image"""
    if values is None:
        width = 2
        values = images.images.SetupPixelRead(format, (width, 4), type)
    arrayType = arrays.GL_CONSTANT_TO_ARRAY_TYPE[
        images.images.TYPE_TO_ARRAYTYPE.get(type, type)]
    baseFunction(target, reset, format, type,
                 ctypes.c_void_p(arrayType.dataPointer(values)))
    return values


# 4-items, specified in spec...
glColorTableParameterfv = arrays.setInputArraySizeType(
    simple.glColorTableParameterfv,
    4,
    arrays.GLfloatArray,
    'params',
)
GL_GET_CTP_SIZES = {
    GL_COLOR_TABLE_FORMAT: 1,
    GL_COLOR_TABLE_WIDTH: 1,
    GL_COLOR_TABLE_RED_SIZE: 1,
    GL_COLOR_TABLE_GREEN_SIZE: 1,
    GL_COLOR_TABLE_BLUE_SIZE: 1,
    GL_COLOR_TABLE_ALPHA_SIZE: 1,
    GL_COLOR_TABLE_LUMINANCE_SIZE: 1,
    GL_COLOR_TABLE_INTENSITY_SIZE: 1,
}
glGetColorTableParameterfv = wrapper.wrapper(
    simple.glGetColorTableParameterfv).setOutput(
        "params",
示例#2
0
The official definition of this extension is available here:
http://www.opengl.org/registry/specs/ARB/transpose_matrix.txt
'''
from OpenGL import platform, constants, constant, arrays
from OpenGL import extensions, wrapper
from OpenGL.GL import glget
import ctypes
from OpenGL.raw.GL.ARB.transpose_matrix import *
### END AUTOGENERATED SECTION
for typ, arrayType in (
    ('d', arrays.GLdoubleArray),
    ('f', arrays.GLfloatArray),
):
    for function in ('glLoadTransposeMatrix', 'glMultTransposeMatrix'):
        name = '%s%sARB' % (function, typ)
        globals()[name] = arrays.setInputArraySizeType(
            globals()[name],
            16,
            arrayType,
            'm',
        )
        try:
            del function, name
        except NameError, err:
            pass
    try:
        del typ, arrayType
    except NameError, err:
        pass
"""
from OpenGL.raw import GLU as raw

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

gluCheckExtension = arrays.setInputArraySizeType(
    arrays.setInputArraySizeType(
        raw.gluCheckExtension,
        None,  # XXX Could not determine size of argument extName for gluCheckExtension arrays.GLubyteArray
        arrays.GLubyteArray,
        'extName',
    ),
    None,  # XXX Could not determine size of argument extString for gluCheckExtension arrays.GLubyteArray
    arrays.GLubyteArray,
    'extString',
)

gluGetNurbsProperty = arrays.setInputArraySizeType(
    raw.gluGetNurbsProperty,
    None,  # XXX Could not determine size of argument data for gluGetNurbsProperty arrays.GLfloatArray
    arrays.GLfloatArray,
    'data',
)

gluGetTessProperty = arrays.setInputArraySizeType(
    raw.gluGetTessProperty,
STRING = c_char_p


gleExtrusion = arrays.setInputArraySizeType(
	arrays.setInputArraySizeType(
		arrays.setInputArraySizeType(
			arrays.setInputArraySizeType(
				arrays.setInputArraySizeType(
					raw.gleExtrusion,
					None, # XXX Could not determine size of argument contour for gleExtrusion arrays.GLdoubleArray
					arrays.GLdoubleArray, 
					'contour',
				),
				None, # XXX Could not determine size of argument cont_normal for gleExtrusion arrays.GLdoubleArray
				arrays.GLdoubleArray, 
				'cont_normal',
			),
			None, # XXX Could not determine size of argument up for gleExtrusion arrays.GLdoubleArray
			arrays.GLdoubleArray, 
			'up',
		),
		None, # XXX Could not determine size of argument point_array for gleExtrusion arrays.GLdoubleArray
		arrays.GLdoubleArray, 
		'point_array',
	),
	None, # XXX Could not determine size of argument color_array for gleExtrusion arrays.GLfloatArray
	arrays.GLfloatArray, 
	'color_array',
)

gleHelicoid = arrays.setInputArraySizeType(
	arrays.setInputArraySizeType(
The official definition of this extension is available here:
http://www.opengl.org/registry/specs/ARB/vertex_buffer_object.txt
'''
from OpenGL import platform, constants, constant, arrays
from OpenGL import extensions, wrapper
from OpenGL.GL import glget
import ctypes
from OpenGL.raw.GL.ARB.vertex_buffer_object import *
### END AUTOGENERATED SECTION
from OpenGL.lazywrapper import lazy
from OpenGL.arrays import ArrayDatatype

glDeleteBuffersARB = arrays.setInputArraySizeType(
    glDeleteBuffersARB,
    None,
    arrays.GLuintArray,
    'buffers',
)

glGenBuffersARB = wrapper.wrapper( glGenBuffersARB ).setOutput(
    'buffers', lambda n: (n,), 'n',
)

def _sizeOfArrayInput( pyArgs, index, wrapper ):
    return (
        arrays.ArrayDatatype.arrayByteCount( pyArgs[index] )
    )

@lazy( glBufferDataARB )
def glBufferDataARB( baseOperation, target, size, data=None, usage=None ):
    """Copy given data into the currently bound vertex-buffer-data object
示例#6
0
        return full.glColor2d( *args )
    elif arglen == 3:
        return full.glColor3d( *args )
    elif arglen == 4:
        return full.glColor4d( *args )
    else:
        raise ValueError( """Don't know how to handle arguments: %s"""%(args,))


# Rectagle coordinates,
glRectfv = arrays.setInputArraySizeType(
    arrays.setInputArraySizeType(
        full.glRectfv,
        2,
        arrays.GLfloatArray,
        'v1',
    ),
    2,
    arrays.GLfloatArray,
    'v2',
)
glRectiv = arrays.setInputArraySizeType(
    arrays.setInputArraySizeType(
        full.glRectiv,
        2,
        arrays.GLintArray,
        'v1',
    ),
    2,
    arrays.GLintArray,
    'v2',
    if values is None:
        width = 2
        values = images.images.SetupPixelRead( format, (width,4), type )
    arrayType = arrays.GL_CONSTANT_TO_ARRAY_TYPE[
        images.images.TYPE_TO_ARRAYTYPE.get(type,type)
    ]
    baseFunction(
        target, reset, format, type,
        ctypes.c_void_p( arrayType.dataPointer(values))
    )
    return values

# 4-items, specified in spec...
glColorTableParameterfv = arrays.setInputArraySizeType(
    simple.glColorTableParameterfv,
    4,
    arrays.GLfloatArray,
    'params',
)
GL_GET_CTP_SIZES = {
    GL_COLOR_TABLE_FORMAT :1,
    GL_COLOR_TABLE_WIDTH  :1,
    GL_COLOR_TABLE_RED_SIZE :1,
    GL_COLOR_TABLE_GREEN_SIZE :1,
    GL_COLOR_TABLE_BLUE_SIZE :1,
    GL_COLOR_TABLE_ALPHA_SIZE :1,
    GL_COLOR_TABLE_LUMINANCE_SIZE :1,
    GL_COLOR_TABLE_INTENSITY_SIZE :1,
}
glGetColorTableParameterfv = wrapper.wrapper(simple.glGetColorTableParameterfv).setOutput(
    "params",GL_GET_CTP_SIZES, "pname",
)
示例#8
0
"""Array-size annotations for OpenGL.raw.GL

Automatically generated by the generateraw script, do not edit!
"""
from OpenGL.raw import GL as raw

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

glAreTexturesResident = arrays.setInputArraySizeType(
    raw.glAreTexturesResident,
    None,  # XXX Could not determine size of argument textures for glAreTexturesResident arrays.GLuintArray
    arrays.GLuintArray,
    'textures',
)

glBitmap = arrays.setInputArraySizeType(
    raw.glBitmap,
    None,  # XXX Could not determine size of argument bitmap for glBitmap arrays.GLubyteArray
    arrays.GLubyteArray,
    'bitmap',
)

glClipPlane = arrays.setInputArraySizeType(
    raw.glClipPlane,
    None,  # XXX Could not determine size of argument equation for glClipPlane arrays.GLdoubleArray
    arrays.GLdoubleArray,
    'equation',
示例#9
0
from OpenGL.raw import GLU as raw

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



gluCheckExtension = arrays.setInputArraySizeType(
    arrays.setInputArraySizeType(
        raw.gluCheckExtension,
        None, # XXX Could not determine size of argument extName for gluCheckExtension arrays.GLubyteArray
        arrays.GLubyteArray, 
        'extName',
    ),
    None, # XXX Could not determine size of argument extString for gluCheckExtension arrays.GLubyteArray
    arrays.GLubyteArray, 
    'extString',
)

gluGetNurbsProperty = arrays.setInputArraySizeType(
    raw.gluGetNurbsProperty,
    None, # XXX Could not determine size of argument data for gluGetNurbsProperty arrays.GLfloatArray
    arrays.GLfloatArray, 
    'data',
)

gluGetTessProperty = arrays.setInputArraySizeType(
    raw.gluGetTessProperty,
示例#10
0
'''OpenGL extension ARB.point_parameters

This module customises the behaviour of the 
OpenGL.raw.GL.ARB.point_parameters to provide a more 
Python-friendly API
'''
from OpenGL import platform, constants, constant, arrays
from OpenGL import extensions, wrapper
from OpenGL.GL import glget
import ctypes
from OpenGL.raw.GL.ARB.point_parameters import *
### END AUTOGENERATED SECTION
from OpenGL.GL import glget
glget.addGLGetConstant( GL_POINT_SIZE_MIN_ARB, (1,) )
glget.addGLGetConstant( GL_POINT_SIZE_MAX_ARB , (1,) )
glget.addGLGetConstant( GL_POINT_FADE_THRESHOLD_SIZE_ARB, (1,) )
glget.addGLGetConstant( GL_POINT_DISTANCE_ATTENUATION_ARB, (3,) )

glPointParameterfvARB = arrays.setInputArraySizeType(
	glPointParameterfvARB,
	None, # XXX should be dependant on the pname field!
	arrays.GLfloatArray, 
	'params',
)
示例#11
0
http://www.opengl.org/registry/specs/VERSION/GL_1_1.txt
'''
from OpenGL import platform, constants, constant, arrays
from OpenGL import extensions, wrapper
from OpenGL.GL import glget
import ctypes
from OpenGL.raw.GL.VERSION.GL_1_1 import *
### END AUTOGENERATED SECTION
GL_MODELVIEW0_EXT = GL_MODELVIEW # alias
GL_MODELVIEW0_MATRIX_EXT = GL_MODELVIEW_MATRIX # alias
GL_MODELVIEW0_STACK_DEPTH_EXT = GL_MODELVIEW_STACK_DEPTH # alias
GL_TEXTURE_COMPONENTS = GL_TEXTURE_INTERNAL_FORMAT # alias

glAreTexturesResident = arrays.setInputArraySizeType(
    glAreTexturesResident,
    None, # XXX Could not determine size of argument textures for glAreTexturesResident arrays.GLuintArray
    arrays.GLuintArray, 
    'textures',
)

glBitmap = arrays.setInputArraySizeType(
    glBitmap,
    None, # XXX Could not determine size of argument bitmap for glBitmap arrays.GLubyteArray
    arrays.GLubyteArray, 
    'bitmap',
)

glClipPlane = arrays.setInputArraySizeType(
    glClipPlane,
    None, # XXX Could not determine size of argument equation for glClipPlane arrays.GLdoubleArray
    arrays.GLdoubleArray, 
    'equation',
示例#12
0
	have the array indices match the expected matrix row and column indexes.
	These arrays are referred to as transpose matrices since they are
	the transpose of the standard matrices passed to OpenGL.
	
	This extension adds an interface for transfering data to and from the
	OpenGL pipeline, it does not change any OpenGL processing or imply any
	changes in state representation.

The official definition of this extension is available here:
http://www.opengl.org/registry/specs/ARB/transpose_matrix.txt
"""
from OpenGL import platform, constants, constant, arrays
from OpenGL import extensions, wrapper
from OpenGL.GL import glget
import ctypes
from OpenGL.raw.GL.ARB.transpose_matrix import *

### END AUTOGENERATED SECTION
for typ, arrayType in (("d", arrays.GLdoubleArray), ("f", arrays.GLfloatArray)):
    for function in ("glLoadTransposeMatrix", "glMultTransposeMatrix"):
        name = "%s%sARB" % (function, typ)
        globals()[name] = arrays.setInputArraySizeType(globals()[name], 16, arrayType, "m")
        try:
            del function, name
        except NameError as err:
            pass
    try:
        del typ, arrayType
    except NameError as err:
        pass
示例#13
0
'''OpenGL extension ARB.point_parameters

This module customises the behaviour of the 
OpenGL.raw.GL.ARB.point_parameters to provide a more 
Python-friendly API
'''
from OpenGL import platform, constants, constant, arrays
from OpenGL import extensions, wrapper
from OpenGL.GL import glget
import ctypes
from OpenGL.raw.GL.ARB.point_parameters import *
### END AUTOGENERATED SECTION
from OpenGL.GL import glget
glget.addGLGetConstant(GL_POINT_SIZE_MIN_ARB, (1, ))
glget.addGLGetConstant(GL_POINT_SIZE_MAX_ARB, (1, ))
glget.addGLGetConstant(GL_POINT_FADE_THRESHOLD_SIZE_ARB, (1, ))
glget.addGLGetConstant(GL_POINT_DISTANCE_ATTENUATION_ARB, (3, ))

glPointParameterfvARB = arrays.setInputArraySizeType(
    glPointParameterfvARB,
    None,  # XXX should be dependant on the pname field!
    arrays.GLfloatArray,
    'params',
)
示例#14
0
    elif arglen == 3:
        return simple.glColor3d(*args)
    elif arglen == 4:
        return simple.glColor4d(*args)
    else:
        raise ValueError("""Don't know how to handle arguments: %s""" %
                         (args, ))


# Rectagle coordinates,
glRectfv = arrays.setInputArraySizeType(
    arrays.setInputArraySizeType(
        simple.glRectfv,
        2,
        arrays.GLfloatArray,
        'v1',
    ),
    2,
    arrays.GLfloatArray,
    'v2',
)
glRectiv = arrays.setInputArraySizeType(
    arrays.setInputArraySizeType(
        simple.glRectiv,
        2,
        arrays.GLintArray,
        'v1',
    ),
    2,
    arrays.GLintArray,
    'v2',
示例#15
0
    )
)
def gluNewTess( baseFunction ):
    """Get a new tessellator object (just unpacks the pointer for you)"""
    return baseFunction()[0]

@lazy( simple.gluGetTessProperty )
def gluGetTessProperty( baseFunction, tess, which, data=None ):
    """Retrieve single double for a tessellator property"""
    if data is None:
        data = simple.GLdouble( 0.0 )
        baseFunction( tess, which, data )
        return data.value
    else:
        return baseFunction( tess, which, data )

gluTessVertexBase = arrays.setInputArraySizeType(
    simple.gluTessVertex,
    3,
    arrays.GLdoubleArray,
    'location',
)

__all__ = (
    'gluNewTess',
    'gluGetTessProperty',
    'gluTessBeginPolygon',
    'gluTessCallback',
    'gluTessVertex',
)
示例#16
0
)

# /usr/include/GL/freeglut_ext.h 98
glutWireSierpinskiSponge = platform.createBaseFunction(
    'glutWireSierpinskiSponge',
    dll=platform.GLUT,
    resultType=None,
    argTypes=[c_int, arrays.GLdoubleArray, GLdouble],
    doc=
    'glutWireSierpinskiSponge( c_int(num_levels), arrays.GLdoubleArray(offset), GLdouble(scale) ) -> None',
    argNames=('num_levels', 'offset', 'scale'),
)

glutWireSierpinskiSponge = arrays.setInputArraySizeType(
    glutWireSierpinskiSponge,
    None,  # XXX Could not determine size of argument offset for glutWireSierpinskiSponge arrays.GLdoubleArray
    arrays.GLdoubleArray,
    'offset',
)

# /usr/include/GL/freeglut_ext.h 99
glutSolidSierpinskiSponge = platform.createBaseFunction(
    'glutSolidSierpinskiSponge',
    dll=platform.GLUT,
    resultType=None,
    argTypes=[c_int, arrays.GLdoubleArray, GLdouble],
    doc=
    'glutSolidSierpinskiSponge( c_int(num_levels), arrays.GLdoubleArray(offset), GLdouble(scale) ) -> None',
    argNames=('num_levels', 'offset', 'scale'),
)

glutSolidSierpinskiSponge = arrays.setInputArraySizeType(
示例#17
0
    argTypes=[],
    doc='glutSolidRhombicDodecahedron(  ) -> None', 
    argNames=(),
)

# /usr/include/GL/freeglut_ext.h 98
glutWireSierpinskiSponge = platform.createBaseFunction( 
    'glutWireSierpinskiSponge', dll=platform.GLUT, resultType=None, 
    argTypes=[c_int, arrays.GLdoubleArray, GLdouble],
    doc='glutWireSierpinskiSponge( c_int(num_levels), arrays.GLdoubleArray(offset), GLdouble(scale) ) -> None', 
    argNames=('num_levels', 'offset', 'scale'),
)

glutWireSierpinskiSponge = arrays.setInputArraySizeType(
    glutWireSierpinskiSponge,
    None, # XXX Could not determine size of argument offset for glutWireSierpinskiSponge arrays.GLdoubleArray
    arrays.GLdoubleArray, 
    'offset',
)

# /usr/include/GL/freeglut_ext.h 99
glutSolidSierpinskiSponge = platform.createBaseFunction( 
    'glutSolidSierpinskiSponge', dll=platform.GLUT, resultType=None, 
    argTypes=[c_int, arrays.GLdoubleArray, GLdouble],
    doc='glutSolidSierpinskiSponge( c_int(num_levels), arrays.GLdoubleArray(offset), GLdouble(scale) ) -> None', 
    argNames=('num_levels', 'offset', 'scale'),
)

glutSolidSierpinskiSponge = arrays.setInputArraySizeType(
    glutSolidSierpinskiSponge,
    None, # XXX Could not determine size of argument offset for glutSolidSierpinskiSponge arrays.GLdoubleArray
    arrays.GLdoubleArray, 
示例#18
0
).setCConverter(
    'length', conv,
).setCConverter(
    'count', conv.totalCount,
)
del conv

for size in (1,2,3,4):
    for format,arrayType in (
        ('f',arrays.GLfloatArray),
        ('i',arrays.GLintArray),
    ):
        name = 'glUniform%(size)s%(format)svARB'%globals()
        globals()[name] = arrays.setInputArraySizeType(
            globals()[name],
            None, # don't want to enforce size...
            arrayType, 
            'value',
        )
        del format, arrayType
    del size

@lazy( glGetObjectParameterivARB )
def glGetObjectParameterivARB( baseOperation, shader, pname ):
    """Retrieve the integer parameter for the given shader"""
    status = arrays.GLintArray.zeros( (1,))
    status[0] = 1 
    baseOperation(
        shader, pname, status
    )
    return status[0]
示例#19
0
import ctypes
from OpenGL.raw.GL.VERSION.GL_1_3 import *
### END AUTOGENERATED SECTION
from OpenGL.GL.VERSION.GL_1_3_images import *

for typ,arrayType in (
    ('d',arrays.GLdoubleArray),
    ('f',arrays.GLfloatArray),
    ('i',arrays.GLintArray),
    ('s',arrays.GLshortArray),
):
    for size in (1,2,3,4):
        name = 'glMultiTexCoord%(size)s%(typ)sv'%globals()
        globals()[name] = arrays.setInputArraySizeType(
            globals()[name],
            size,
            arrayType, 
            'v',
        )
        del size,name
    del typ,arrayType

for typ,arrayType in (
    ('d',arrays.GLdoubleArray),
    ('f',arrays.GLfloatArray),
):
    for function in ('glLoadTransposeMatrix','glMultTransposeMatrix'):
        name = '%s%s'%(function,typ)
        globals()[name] = arrays.setInputArraySizeType(
            globals()[name],
            16,
            arrayType, 
示例#20
0
    'count', conv.totalCount,
)
try:
    del conv
except NameError as err:
    pass

for size in (1,2,3,4):
    for format,arrayType in (
        ('f',arrays.GLfloatArray),
        ('i',arrays.GLintArray),
    ):
        name = 'glUniform%(size)s%(format)sv'%globals()
        globals()[name] = arrays.setInputArraySizeType(
            globals()[name],
            None, # don't want to enforce size...
            arrayType,
            'value',
        )
        try:
            del format, arrayType
        except NameError as err:
            pass
    try:
        del size,name
    except NameError as err:
        pass

@lazy( glGetShaderiv )
def glGetShaderiv( baseOperation, shader, pname, status=None ):
    """Retrieve the integer parameter for the given shader
'''OpenGL extension ARB.window_pos

This module customises the behaviour of the 
OpenGL.raw.GL.ARB.window_pos to provide a more 
Python-friendly API
'''
from OpenGL import platform, constants, constant, arrays
from OpenGL import extensions, wrapper
from OpenGL.GL import glget
import ctypes
from OpenGL.raw.GL.ARB.window_pos import *
### END AUTOGENERATED SECTION
glWindowPos2dvARB = arrays.setInputArraySizeType(
	glWindowPos2dvARB,
	2,
	arrays.GLdoubleArray,
	'v',
)
glWindowPos2fvARB = arrays.setInputArraySizeType(
	glWindowPos2fvARB,
	2,
	arrays.GLfloatArray,
	'v',
)
glWindowPos2ivARB = arrays.setInputArraySizeType(
	glWindowPos2ivARB,
	2,
	arrays.GLintArray,
	'v',
)
glWindowPos2svARB = arrays.setInputArraySizeType(
示例#22
0
).setCConverter(
	'length', conv,
).setCConverter(
	'count', conv.totalCount,
)
del conv

for size in (1,2,3,4):
	for format,arrayType in (
		('f',arrays.GLfloatArray),
		('i',arrays.GLintArray),
	):
		name = 'glUniform%(size)s%(format)sv'%globals()
		globals()[name] = arrays.setInputArraySizeType(
			globals()[name],
			size,
			arrayType, 
			'value',
		)
		del format, arrayType
	del size

@lazy( glGetShaderiv )
def glGetShaderiv( baseOperation, shader, pname ):
	"""Retrieve the integer parameter for the given shader"""
	status = arrays.GLintArray.zeros( (1,))
	status[0] = 1 
	baseOperation(
		shader, pname, status
	)
	return status[0]
@lazy( glGetProgramiv )
示例#23
0
"""
from OpenGL.raw import GLU as raw

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

gluCheckExtension = arrays.setInputArraySizeType(
    arrays.setInputArraySizeType(
        raw.gluCheckExtension,
        None,  # XXX Could not determine size of argument extName for gluCheckExtension arrays.GLubyteArray
        arrays.GLubyteArray,
        "extName",
    ),
    None,  # XXX Could not determine size of argument extString for gluCheckExtension arrays.GLubyteArray
    arrays.GLubyteArray,
    "extString",
)

gluGetNurbsProperty = arrays.setInputArraySizeType(
    raw.gluGetNurbsProperty,
    None,  # XXX Could not determine size of argument data for gluGetNurbsProperty arrays.GLfloatArray
    arrays.GLfloatArray,
    "data",
)

gluGetTessProperty = arrays.setInputArraySizeType(
    raw.gluGetTessProperty,