コード例 #1
0
ファイル: pointers.py プロジェクト: dondyabla/proMiniTest
def wrapPointerFunction( name, baseFunction, glType, arrayType,startArgs, defaultSize ):
    """Wrap the given pointer-setting function"""
    function= wrapper.wrapper( baseFunction )
    if 'ptr' in baseFunction.argNames:
        pointer_name = 'ptr'
    else:
        pointer_name = 'pointer'
    assert not getattr( function, 'pyConverters', None ), """Reusing wrappers?"""
    if arrayType:
        arrayModuleType = arrays.GL_CONSTANT_TO_ARRAY_TYPE[ glType ]
        function.setPyConverter( pointer_name, arrays.asArrayType(arrayModuleType) )
    else:
        function.setPyConverter( pointer_name, arrays.AsArrayOfType(pointer_name,'type') )
    function.setCConverter( pointer_name, converters.getPyArgsName( pointer_name ) )
    if 'size' in function.argNames:
        function.setPyConverter( 'size' )
        function.setCConverter( 'size', arrays.arraySizeOfFirstType(arrayModuleType,defaultSize) )
    if 'type' in function.argNames:
        function.setPyConverter( 'type' )
        function.setCConverter( 'type', glType )
    if 'stride' in function.argNames:
        function.setPyConverter( 'stride' )
        function.setCConverter( 'stride', 0 )
    function.setStoreValues( arrays.storePointerType( pointer_name, arrayType ) )
    function.setReturnValues( wrapper.returnPyArgument( pointer_name ) )
    return name,function
コード例 #2
0
ファイル: pointers.py プロジェクト: dondyabla/proMiniTest

for name,function in [
    wrapPointerFunction( *args )
    for args in POINTER_FUNCTION_DATA
]:
    globals()[name] = function
try:
    del name, function
except NameError, err:
    pass

glVertexPointer = wrapper.wrapper( simple.glVertexPointer ).setPyConverter(
    'pointer', arrays.AsArrayOfType( 'pointer', 'type' ),
).setStoreValues(
    arrays.storePointerType( 'pointer', simple.GL_VERTEX_ARRAY_POINTER )
).setReturnValues(
    wrapper.returnPyArgument( 'pointer' )
)
glTexCoordPointer = wrapper.wrapper( simple.glTexCoordPointer ).setPyConverter(
    'pointer', arrays.AsArrayOfType( 'pointer', 'type' ),
).setStoreValues(
    arrays.storePointerType( 'pointer', simple.GL_TEXTURE_COORD_ARRAY_POINTER )
).setReturnValues(
    wrapper.returnPyArgument( 'pointer' )
)
glNormalPointer = wrapper.wrapper( simple.glNormalPointer ).setPyConverter(
    'pointer', arrays.AsArrayOfType( 'pointer', 'type' ),
).setStoreValues(
    arrays.storePointerType( 'pointer', simple.GL_NORMAL_ARRAY_POINTER )
).setReturnValues(