1
'''OpenGL extension VERSION.GL_1_5
3
This module customises the behaviour of the
4
OpenGL.raw.GL.VERSION.GL_1_5 to provide a more
7
The official definition of this extension is available here:
8
http://www.opengl.org/registry/specs/VERSION/GL_1_5.txt
10
from OpenGL import platform, constants, constant, arrays
11
from OpenGL import extensions, wrapper
12
from OpenGL.GL import glget
14
from OpenGL.raw.GL.VERSION.GL_1_5 import *
15
### END AUTOGENERATED SECTION
16
from OpenGL.lazywrapper import lazy
17
from OpenGL.arrays import ArrayDatatype
19
glDeleteBuffers = arrays.setInputArraySizeType(
26
glGenBuffers = wrapper.wrapper( glGenBuffers ).setOutput(
27
'buffers', lambda n: (n,), 'n',
30
def _sizeOfArrayInput( pyArgs, index, wrapper ):
32
arrays.ArrayDatatype.arrayByteCount( pyArgs[index] )
36
def glBufferData( baseOperation, target, size, data=None, usage=None ):
37
"""Copy given data into the currently bound vertex-buffer-data object
39
target -- the symbolic constant indicating which buffer type is intended
40
size -- if provided, the count-in-bytes of the array
41
data -- data-pointer to be used, may be None to initialize without
42
copying over a data-set
43
usage -- hint to the driver as to how to set up access to the buffer
45
Note: parameter "size" can be omitted, which makes the signature
46
glBufferData( target, data, usage )
48
glBufferData( target, size, data, usage )
54
data = ArrayDatatype.asArray( data )
56
size = ArrayDatatype.arrayByteCount( data )
57
return baseOperation( target, size, data, usage )
59
@lazy( glBufferSubData )
60
def glBufferSubData( baseOperation, target, offset, size, data=None ):
61
"""Copy subset of data into the currently bound vertex-buffer-data object
63
target -- the symbolic constant indicating which buffer type is intended
64
offset -- offset from beginning of buffer at which to copy bytes
65
size -- the count-in-bytes of the array (if an int/long), if None,
66
calculate size from data, if an array and data is None, use as
67
data (i.e. the parameter can be omitted and calculated)
68
data -- data-pointer to be used, may be None to initialize without
69
copying over a data-set
71
Note that if size is not an int/long it is considered to be data
76
except TypeError as err:
79
"""Expect an integer size *or* a data-array, not both"""
83
data = ArrayDatatype.asArray( data )
85
size = ArrayDatatype.arrayByteCount( data )
86
return baseOperation( target, offset, size, data )
88
glGetBufferParameteriv = wrapper.wrapper(glGetBufferParameteriv).setOutput(
91
@lazy( glGetBufferPointerv )
92
def glGetBufferPointerv( baseOperation, target, pname, params=None ):
93
"""Retrieve a ctypes pointer to buffer's data"""
95
size = glGetBufferParameteriv( target, GL_BUFFER_SIZE )
96
data = arrays.ArrayDatatype.zeros( (size,), GL_UNSIGNED_BYTE )
97
result = baseOperation( target, pname, ctypes.byref( data ) )
100
return baseOperation( target, pname, params )
102
@lazy( glDeleteQueries )
103
def glDeleteQueries( baseOperation, n, ids=None ):
105
ids = arrays.GLuintArray.asArray( ids )
106
n = arrays.GLuintArray.arraySize( ids )
108
ids = arrays.GLuintArray.asArray( ids )
109
return baseOperation( n,ids )
110
@lazy( glGenQueries )
111
def glGenQueries( baseOperation, n, ids=None ):
112
"""Generate n queries, if ids is None, is allocated
117
ids = arrays.GLuintArray.zeros( (n,))
119
ids = arrays.GLuintArray.asArray( ids )
120
baseOperation( n, ids )
124
'glGetQueryiv','glGetQueryObjectiv','glGetQueryObjectuiv',
126
globals()[func] = wrapper.wrapper(globals()[func]).setOutput(