コード例 #1
0
def glGetConvolutionFilter(baseFunction, target, format, type):
    """Retrieve 1 or 2D convolution parameter "kernels" as pixel data"""
    from OpenGL.error import glCheckError
    glCheckError(None)
    dims = (glGetConvolutionParameteriv(target, GL_CONVOLUTION_WIDTH)[0], )
    if target != GL_CONVOLUTION_1D:
        dims += (glGetConvolutionParameteriv(target,
                                             GL_CONVOLUTION_HEIGHT)[0], )
    # is it always 4?  Seems to be, but the spec/man-page isn't really clear about it...
    dims += (4, )
    array = images.images.SetupPixelRead(format, dims, type)
    arrayType = arrays.GL_CONSTANT_TO_ARRAY_TYPE[
        images.images.TYPE_TO_ARRAYTYPE.get(type, type)]
    baseFunction(target, format, type,
                 ctypes.c_void_p(arrayType.dataPointer(array)))
    return array
コード例 #2
0
 def GLSLCheckError(result, baseOperation=None, cArguments=None, *args):
     result = error.glCheckError(result, baseOperation, cArguments, *args)
     status = glGetObjectParameterivARB(cArguments[0], key)
     if not status:
         raise error.GLError(result=result,
                             baseOperation=baseOperation,
                             cArguments=cArguments,
                             description=glGetInfoLogARB(cArguments[0]))
     return result
コード例 #3
0
ファイル: tests.py プロジェクト: bsergean/oglshow
	def test_glAreTexturesResident( self ):
		"""Test that PyOpenGL api for glAreTexturesResident is working
		
		Note: not currently working on AMD64 Linux for some reason
		"""
		import numpy
		textures = glGenTextures(2)
		residents = []
		for texture in textures:
			glBindTexture( GL_TEXTURE_2D,int(texture) )
			glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, 1, 1, 0, GL_RGB, GL_INT, self.someData)
			residents.append(
				glGetTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_RESIDENT )
			)
		error.glCheckError(None)
		result = glAreTexturesResident( textures)
		assert len(result) == 2
		for (tex,expected,found) in zip( textures, residents, result ):
			if expected != found:
				print 'Warning: texture %s residence expected %s got %s'%( tex, expected, found )
コード例 #4
0
ファイル: GL_2_0.py プロジェクト: dondyabla/proMiniTest
 def GLSLCheckError(result, baseOperation=None, cArguments=None, *args):
     result = error.glCheckError(result, baseOperation, cArguments, *args)
     status = ctypes.c_int()
     getter(cArguments[0], key, ctypes.byref(status))
     status = status.value
     if not status:
         raise error.GLError(result=result,
                             baseOperation=baseOperation,
                             cArguments=cArguments,
                             description=glGetInfoLog(cArguments[0]))
     return result
コード例 #5
0
 def GLSLCheckError(result, baseOperation=None, cArguments=None, *args):
     result = error.glCheckError(result, baseOperation, cArguments, *args)
     status = glGetObjectParameterivARB(cArguments[0], key)
     if not status:
         raise error.GLError(
             result=result,
             baseOperation=baseOperation,
             cArguments=cArguments,
             description=glGetInfoLogARB(cArguments[0]),
         )
     return result
コード例 #6
0
ファイル: test_core.py プロジェクト: dondyabla/proMiniTest
 def test_glAreTexturesResident( self ):
     """Test that PyOpenGL api for glAreTexturesResident is working
     
     Note: not currently working on AMD64 Linux for some reason
     """
     import numpy
     textures = glGenTextures(2)
     residents = []
     data = numpy.array( self.someData,'i' )
     for texture in textures:
         glBindTexture( GL_TEXTURE_2D,int(texture) )
         glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, 1, 1, 0, GL_RGB, GL_INT, data)
         residents.append(
             glGetTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_RESIDENT )
         )
     error.glCheckError(None)
     result = glAreTexturesResident( textures)
     assert len(result) == 2
     for (tex,expected,found) in zip( textures, residents, result ):
         if expected != found:
             print('Warning: texture %s residence expected %s got %s'%( tex, expected, found ))
コード例 #7
0
def glGetConvolutionFilter( baseFunction, target, format, type ):
    """Retrieve 1 or 2D convolution parameter "kernels" as pixel data"""
    from OpenGL.error import glCheckError
    glCheckError(None)
    dims = (
        glGetConvolutionParameteriv( target, GL_CONVOLUTION_WIDTH )[0],
    )
    if target != GL_CONVOLUTION_1D:
        dims += (
            glGetConvolutionParameteriv( target, GL_CONVOLUTION_HEIGHT )[0],
        )
    # is it always 4?  Seems to be, but the spec/man-page isn't really clear about it...
    dims += (4,)
    array = images.images.SetupPixelRead( format, dims, type )
    arrayType = arrays.GL_CONSTANT_TO_ARRAY_TYPE[
        images.images.TYPE_TO_ARRAYTYPE.get(type,type)
    ]
    baseFunction(
        target, format, type,
        ctypes.c_void_p( arrayType.dataPointer(array))
    )
    return array
コード例 #8
0
ファイル: GL_2_0.py プロジェクト: Kupoman/conceptparticles
 def GLSLCheckError(
     result,
     baseOperation=None,
     cArguments=None,
     *args
 ):
     result = error.glCheckError( result, baseOperation, cArguments, *args )
     status = ctypes.c_int()
     getter( cArguments[0], key, ctypes.byref(status))
     status = status.value
     if not status:
         raise error.GLError(
             result = result,
             baseOperation = baseOperation,
             cArguments = cArguments,
             description= glGetInfoLog( cArguments[0] )
         )
     return result