本文整理汇总了Python中OpenGL.arrays.ArrayDatatype.asArray方法的典型用法代码示例。如果您正苦于以下问题:Python ArrayDatatype.asArray方法的具体用法?Python ArrayDatatype.asArray怎么用?Python ArrayDatatype.asArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenGL.arrays.ArrayDatatype
的用法示例。
在下文中一共展示了ArrayDatatype.asArray方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: glBufferSubData
# 需要导入模块: from OpenGL.arrays import ArrayDatatype [as 别名]
# 或者: from OpenGL.arrays.ArrayDatatype import asArray [as 别名]
def glBufferSubData( baseOperation, target, offset, size=None, data=None ):
"""Copy subset of data into the currently bound vertex-buffer-data object
target -- the symbolic constant indicating which buffer type is intended
offset -- offset from beginning of buffer at which to copy bytes
size -- the count-in-bytes of the array (if an int/long), if None,
calculate size from data, if an array and data is None, use as
data (i.e. the parameter can be omitted and calculated)
data -- data-pointer to be used, may be None to initialize without
copying over a data-set
Note that if size is not an int/long it is considered to be data
*iff* data is None
"""
if size is None:
if data is None:
raise TypeError( "Need data or size" )
elif (not isinstance( size, integer_types)) and (data is None):
data = size
size = None
try:
if size is not None:
size = int( size )
except TypeError:
if data is not None:
raise TypeError(
"""Expect an integer size *or* a data-array, not both"""
)
data = size
size = None
data = ArrayDatatype.asArray( data )
if size is None:
size = ArrayDatatype.arrayByteCount( data )
return baseOperation( target, offset, size, data )
示例2: glBufferDataARB
# 需要导入模块: from OpenGL.arrays import ArrayDatatype [as 别名]
# 或者: from OpenGL.arrays.ArrayDatatype import asArray [as 别名]
def glBufferDataARB( baseOperation, target, size, data=None, usage=None ):
"""Copy given data into the currently bound vertex-buffer-data object
target -- the symbolic constant indicating which buffer type is intended
size -- if provided, the count-in-bytes of the array
data -- data-pointer to be used, may be None to initialize without
copying over a data-set
usage -- hint to the driver as to how to set up access to the buffer
Note: parameter "size" can be omitted, which makes the signature
glBufferData( target, data, usage )
instead of:
glBufferData( target, size, data, usage )
"""
if usage is None:
usage = data
data = size
size = None
data = ArrayDatatype.asArray( data )
if size is None:
size = ArrayDatatype.arrayByteCount( data )
return baseOperation( target, size, data, usage )
示例3: baseOperation
# 需要导入模块: from OpenGL.arrays import ArrayDatatype [as 别名]
# 或者: from OpenGL.arrays.ArrayDatatype import asArray [as 别名]
return baseOperation( target, size, data, usage )
@lazy( glBufferSubDataARB )
def glBufferSubDataARB( baseOperation, target, offset, size, data=None ):
"""Copy subset of data into the currently bound vertex-buffer-data object
target -- the symbolic constant indicating which buffer type is intended
offset -- offset from beginning of buffer at which to copy bytes
size -- the count-in-bytes of the array (if an int/long), if None,
calculate size from data, if an array and data is None, use as
data (i.e. the parameter can be omitted and calculated)
data -- data-pointer to be used, may be None to initialize without
copying over a data-set
Note that if size is not an int/long it is considered to be data
"""
try:
if size is not None:
size = int( size )
except TypeError, err:
if data is not None:
raise TypeError(
"""Expect an integer size *or* a data-array, not both"""
)
data = size
size = None
data = ArrayDatatype.asArray( data )
if size is None:
size = ArrayDatatype.arrayByteCount( data )
return baseOperation( target, offset, size, data )