本文整理汇总了Python中OpenGL.arrays.arraydatatype.ArrayDatatype.voidDataPointer方法的典型用法代码示例。如果您正苦于以下问题:Python ArrayDatatype.voidDataPointer方法的具体用法?Python ArrayDatatype.voidDataPointer怎么用?Python ArrayDatatype.voidDataPointer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenGL.arrays.arraydatatype.ArrayDatatype
的用法示例。
在下文中一共展示了ArrayDatatype.voidDataPointer方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: glVertexAttribPointer
# 需要导入模块: from OpenGL.arrays.arraydatatype import ArrayDatatype [as 别名]
# 或者: from OpenGL.arrays.arraydatatype.ArrayDatatype import voidDataPointer [as 别名]
def glVertexAttribPointer(
baseOperation, index, size, type,
normalized, stride, pointer,
):
"""Set an attribute pointer for a given shader (index)
index -- the index of the generic vertex to bind, see
glGetAttribLocation for retrieval of the value,
note that index is a global variable, not per-shader
size -- number of basic elements per record, 1,2,3, or 4
type -- enum constant for data-type
normalized -- whether to perform int to float
normalization on integer-type values
stride -- stride in machine units (bytes) between
consecutive records, normally used to create
"interleaved" arrays
pointer -- data-pointer which provides the data-values,
normally a vertex-buffer-object or offset into the
same.
This implementation stores a copy of the data-pointer
in the contextdata structure in order to prevent null-
reference errors in the renderer.
"""
array = ArrayDatatype.asArray( pointer, type )
key = ('vertex-attrib',index)
contextdata.setValue( key, array )
return baseOperation(
index, size, type,
normalized, stride,
ArrayDatatype.voidDataPointer( array )
)
示例2: copy_data
# 需要导入模块: from OpenGL.arrays.arraydatatype import ArrayDatatype [as 别名]
# 或者: from OpenGL.arrays.arraydatatype.ArrayDatatype import voidDataPointer [as 别名]
def copy_data( self ):
"""Copy our data into the buffer on the GL side (if required)
Ensures that the GL's version of the data in the VBO matches our
internal view of the data, either by copying the entire data-set
over with glBufferData or by updating the already-transferred
data with glBufferSubData.
"""
assert self.buffers, """Should do create_buffers before copy_data"""
if self.copied:
if self._copy_segments:
while self._copy_segments:
start,size,data = self._copy_segments.pop(0)
dataptr = ArrayDatatype.voidDataPointer( data )
self.implementation.glBufferSubData(self.target, start, size, dataptr)
else:
if self.data is not None and self.size is None:
self.size = ArrayDatatype.arrayByteCount( self.data )
self.implementation.glBufferData(
self.target,
self.size,
self.data,
self.usage,
)
self.copied = True
示例3: copy_data
# 需要导入模块: from OpenGL.arrays.arraydatatype import ArrayDatatype [as 别名]
# 或者: from OpenGL.arrays.arraydatatype.ArrayDatatype import voidDataPointer [as 别名]
def copy_data( self ):
"""Copy our data into the buffer on the GL side"""
assert self.buffers, """Should do create_buffers before copy_data"""
if self.copied:
if self._copy_segments:
while self._copy_segments:
start,size,data = self._copy_segments.pop(0)
dataptr = ArrayDatatype.voidDataPointer( data )
self.implementation.glBufferSubData(self.target, start, size, dataptr)
else:
self.implementation.glBufferData(
self.target,
self.data,
self.usage,
)
self.copied = True
示例4: setSlice
# 需要导入模块: from OpenGL.arrays.arraydatatype import ArrayDatatype [as 别名]
# 或者: from OpenGL.arrays.arraydatatype.ArrayDatatype import voidDataPointer [as 别名]
def setSlice(self, start, size, data):
"""
sets a slice of data.
"""
dataptr = ArrayDatatype.voidDataPointer( data )
gl.glBufferSubData( self.target, start, size, dataptr )