Beispiel #1
0
    def initializeGL(self):
        '''
        Initialize GL
        '''
        global mod
        
        if not hasGLExtension("GL_ARB_framebuffer_object"):
            print "GL_ARB_framebuffer_object not supported, switching to GL_GENERATE_MIPMAP"
            self.npot = 2
        version = glGetString(GL_VERSION)
        if int(version[0]) == 1 and int(version[2]) < 4: #no opengl 1.4 support
            print "GL_GENERATE_MIPMAP not supported, not using mipmapping"
            self.npot = 1
        if not hasGLExtension("GL_ARB_texture_non_power_of_two"):
            print "GL_ARB_texture_non_power_of_two not supported, switching to GL_ARB_texture_rectangle"
            self.texext = GL_TEXTURE_RECTANGLE_ARB
            self.npot = 1
        if not hasGLExtension("GL_ARB_texture_rectangle"):
            print "GL_TEXTURE_RECTANGLE_ARB not supported, switching to GL_TEXTURE_2D"
            self.texext = GL_TEXTURE_2D
            self.npot = 0

        glEnable(self.texext)
        glEnable(GL_BLEND)
        glDisable(GL_DEPTH_TEST)
        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
        glViewport(0, 0, self.width(), self.height())
        glClearColor(0.0, 0.0, 0.0, 0.0)
        glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST)

        initok = False
        if mod:
            ret = glmod.init(self.texext)
            if ret == -1:
                print "Something terrible went wrong in initializing glmod"
                mod = False
            elif ret == -2:
                print "using gl module without VBO support"
            else:
                initok = True
                print "using gl module with VBO support"

        if mod and initok:
            if glInitVertexBufferObjectARB() and bool(glBindBufferARB):
                self.vbos = True
                print "VBO support initialised succesfully"
                self.VBO = int(glGenBuffersARB(1))
                glmod.initVBO(self.VBO, ADT.arrayByteCount(numpy.zeros((2, 2), 'f')))
            else:
                print "VBO support initialisation failed, continuing without"
Beispiel #2
0
def glInitFenceSyncKHR():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension( _EXTENSION_NAME )


### END AUTOGENERATED SECTION
def glInitFragmentCoverageToColorNV():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension( _EXTENSION_NAME )


### END AUTOGENERATED SECTION
def glInitTextureCompressionS3TcUpdateNV():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension( _EXTENSION_NAME )


### END AUTOGENERATED SECTION
def glInitCompressedTexturePixelStorageARB():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension( _EXTENSION_NAME )


### END AUTOGENERATED SECTION
def glInitDigitalVideoControlI3D():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension( _EXTENSION_NAME )


### END AUTOGENERATED SECTION
def glInitDrawBuffersIndexedOES():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension( _EXTENSION_NAME )


### END AUTOGENERATED SECTION
def glInitShadowSamplersCubeNV():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension( _EXTENSION_NAME )


### END AUTOGENERATED SECTION
def glInitSeamlessCubemapPerTextureARB():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension( _EXTENSION_NAME )


### END AUTOGENERATED SECTION
def glInitStreamConsumerEgloutputEXT():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension( _EXTENSION_NAME )


### END AUTOGENERATED SECTION
def glInitFramebufferMultisampleAPPLE():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension( _EXTENSION_NAME )


### END AUTOGENERATED SECTION
def glInitPathRenderingSharedEdgeNV():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension( _EXTENSION_NAME )


### END AUTOGENERATED SECTION
def glInitGetTransparentIndexSUN():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension( _EXTENSION_NAME )


### END AUTOGENERATED SECTION
def glInitSharedTexturePaletteEXT():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension( _EXTENSION_NAME )


### END AUTOGENERATED SECTION
def glInitTextureMirrorClampToEdgeARB():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension( _EXTENSION_NAME )


### END AUTOGENERATED SECTION
def glInitPolygonOffsetClampEXT():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension( _EXTENSION_NAME )


### END AUTOGENERATED SECTION
Beispiel #17
0
def glInitTransformFeedback4AMD():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension( _EXTENSION_NAME )


### END AUTOGENERATED SECTION
def glInitPrimitiveBoundingBoxEXT():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension( _EXTENSION_NAME )


### END AUTOGENERATED SECTION
Beispiel #19
0
def glInitMaliProgramBinaryARM():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension( _EXTENSION_NAME )


### END AUTOGENERATED SECTION
def glInitConservativeRasterDilateNV():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension( _EXTENSION_NAME )


### END AUTOGENERATED SECTION
Beispiel #21
0
def glInitQueryBufferObjectAMD():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension( _EXTENSION_NAME )


### END AUTOGENERATED SECTION
def glInitShaderFramebufferFetchDepthStencilARM():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension( _EXTENSION_NAME )


### END AUTOGENERATED SECTION
def glInitColorBufferPackedFloatAPPLE():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension( _EXTENSION_NAME )


### END AUTOGENERATED SECTION
def glInitRequiredInternalformatOES():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension( _EXTENSION_NAME )


### END AUTOGENERATED SECTION
def glInitVertexShaderTessellatorAMD():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension( _EXTENSION_NAME )


### END AUTOGENERATED SECTION
def glInitMultisampledRenderToTextureEXT():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension( _EXTENSION_NAME )


### END AUTOGENERATED SECTION
def glInitStandardDerivativesOES():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension( _EXTENSION_NAME )


### END AUTOGENERATED SECTION
def glInitConditionalRenderInvertedARB():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension( _EXTENSION_NAME )


### END AUTOGENERATED SECTION
def glInitTextureFormatBgra8888APPLE():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension( _EXTENSION_NAME )


### END AUTOGENERATED SECTION
def glInitShadingLanguagePackingARB():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension( _EXTENSION_NAME )


### END AUTOGENERATED SECTION
def glInitParameterBufferObjectNV():
    '''Return boolean indicating whether this extension is available'''
    return extensions.hasGLExtension(EXTENSION_NAME)
Beispiel #32
0
def glInitMiscAttributeEXT():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension(EXTENSION_NAME)
def glInitRobustnessKHR():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension(_EXTENSION_NAME)
Beispiel #34
0
def glInitEs2CompatibilityARB():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension(_EXTENSION_NAME)
Beispiel #35
0
def glInitExtendedGet2QCOM():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension(_EXTENSION_NAME)
Beispiel #36
0
def glInitTextureRectangleNV():
    '''Return boolean indicating whether this extension is available'''
    return extensions.hasGLExtension(EXTENSION_NAME)
Beispiel #37
0
def glInitGetProgramBinaryOES():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension(_EXTENSION_NAME)
Beispiel #38
0
def glInitVertexArrayRangeAPPLE():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension(_EXTENSION_NAME)
Beispiel #39
0
def glInitDrawInstancedARB():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension(EXTENSION_NAME)
Beispiel #40
0
def glInitEgl15VERSION():
    """Return boolean indicating whether this extension is available"""
    from OpenGL import extensions
    return extensions.hasGLExtension(_EXTENSION_NAME)
def glInitClientStorageAPPLE():
    '''Return boolean indicating whether this extension is available'''
    return extensions.hasGLExtension(EXTENSION_NAME)
def glInitFragmentLightingSGIX():
    '''Return boolean indicating whether this extension is available'''
    return extensions.hasGLExtension(EXTENSION_NAME)
Beispiel #43
0
def glInitTextureRgb10A2UiARB():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension(EXTENSION_NAME)
def glInitFragmentCoordConventionsARB():
    '''Return boolean indicating whether this extension is available'''
    return extensions.hasGLExtension(EXTENSION_NAME)
Beispiel #45
0
def glInitConvolutionBorderModesSUN():
    '''Return boolean indicating whether this extension is available'''
    return extensions.hasGLExtension(EXTENSION_NAME)
def glInitSeamlessCubemapPerTextureAMD():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension(EXTENSION_NAME)
def glInitPointParametersARB():
    '''Return boolean indicating whether this extension is available'''
    return extensions.hasGLExtension( EXTENSION_NAME )
Beispiel #48
0
def glInitBlendFuncSeparateEXT():
    '''Return boolean indicating whether this extension is available'''
    return extensions.hasGLExtension(EXTENSION_NAME)
Beispiel #49
0
def glInitBlendMinmaxFactorAMD():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension( EXTENSION_NAME )
Beispiel #50
0
def glInitTextureBorderClampARB():
	'''Return boolean indicating whether this extension is available'''
	return extensions.hasGLExtension( EXTENSION_NAME )
Beispiel #51
0
def glInitQueryMatrixOES():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension( _EXTENSION_NAME )
Beispiel #52
0
def glInitTransformFeedback2ARB():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension(_EXTENSION_NAME)
def glInitDrawInstancedEXT():
    '''Return boolean indicating whether this extension is available'''
    return extensions.hasGLExtension(EXTENSION_NAME)
def glInitMultisampleFilterHintNV():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension(EXTENSION_NAME)
Beispiel #55
0
def glInitMultiDrawArraysEXT():
    """Return boolean indicating whether this extension is available"""
    from OpenGL import extensions
    return extensions.hasGLExtension(_EXTENSION_NAME)
Beispiel #56
0
def glInitFramebufferObjectEXT():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension(_EXTENSION_NAME)
def glInitFragmentShaderATI():
    """Return boolean indicating whether this extension is available"""
    from OpenGL import extensions
    return extensions.hasGLExtension(_EXTENSION_NAME)
Beispiel #58
0
def glInitGlobalAlphaSUN():
	'''Return boolean indicating whether this extension is available'''
	return extensions.hasGLExtension( EXTENSION_NAME )
def glInitReadFormatOES():
    '''Return boolean indicating whether this extension is available'''
    return extensions.hasGLExtension(EXTENSION_NAME)
Beispiel #60
0
def glInitFogFunctionSGIS():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension(EXTENSION_NAME)