Пример #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"
Пример #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
Пример #6
0
def glInitDigitalVideoControlI3D():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension( _EXTENSION_NAME )


### END AUTOGENERATED SECTION
Пример #7
0
def glInitDrawBuffersIndexedOES():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension( _EXTENSION_NAME )


### END AUTOGENERATED SECTION
Пример #8
0
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
Пример #10
0
def glInitStreamConsumerEgloutputEXT():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension( _EXTENSION_NAME )


### END AUTOGENERATED SECTION
Пример #11
0
def glInitFramebufferMultisampleAPPLE():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension( _EXTENSION_NAME )


### END AUTOGENERATED SECTION
Пример #12
0
def glInitPathRenderingSharedEdgeNV():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension( _EXTENSION_NAME )


### END AUTOGENERATED SECTION
Пример #13
0
def glInitGetTransparentIndexSUN():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension( _EXTENSION_NAME )


### END AUTOGENERATED SECTION
Пример #14
0
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
Пример #16
0
def glInitPolygonOffsetClampEXT():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension( _EXTENSION_NAME )


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


### END AUTOGENERATED SECTION
Пример #18
0
def glInitPrimitiveBoundingBoxEXT():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension( _EXTENSION_NAME )


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


### END AUTOGENERATED SECTION
Пример #20
0
def glInitConservativeRasterDilateNV():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension( _EXTENSION_NAME )


### END AUTOGENERATED SECTION
Пример #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
Пример #23
0
def glInitColorBufferPackedFloatAPPLE():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension( _EXTENSION_NAME )


### END AUTOGENERATED SECTION
Пример #24
0
def glInitRequiredInternalformatOES():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension( _EXTENSION_NAME )


### END AUTOGENERATED SECTION
Пример #25
0
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
Пример #27
0
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
Пример #29
0
def glInitTextureFormatBgra8888APPLE():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension( _EXTENSION_NAME )


### END AUTOGENERATED SECTION
Пример #30
0
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)
Пример #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)
Пример #34
0
def glInitEs2CompatibilityARB():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension(_EXTENSION_NAME)
Пример #35
0
def glInitExtendedGet2QCOM():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension(_EXTENSION_NAME)
Пример #36
0
def glInitTextureRectangleNV():
    '''Return boolean indicating whether this extension is available'''
    return extensions.hasGLExtension(EXTENSION_NAME)
Пример #37
0
def glInitGetProgramBinaryOES():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension(_EXTENSION_NAME)
Пример #38
0
def glInitVertexArrayRangeAPPLE():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension(_EXTENSION_NAME)
Пример #39
0
def glInitDrawInstancedARB():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension(EXTENSION_NAME)
Пример #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)
Пример #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)
Пример #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 )
Пример #48
0
def glInitBlendFuncSeparateEXT():
    '''Return boolean indicating whether this extension is available'''
    return extensions.hasGLExtension(EXTENSION_NAME)
Пример #49
0
def glInitBlendMinmaxFactorAMD():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension( EXTENSION_NAME )
Пример #50
0
def glInitTextureBorderClampARB():
	'''Return boolean indicating whether this extension is available'''
	return extensions.hasGLExtension( EXTENSION_NAME )
Пример #51
0
def glInitQueryMatrixOES():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension( _EXTENSION_NAME )
Пример #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)
Пример #55
0
def glInitMultiDrawArraysEXT():
    """Return boolean indicating whether this extension is available"""
    from OpenGL import extensions
    return extensions.hasGLExtension(_EXTENSION_NAME)
Пример #56
0
def glInitFramebufferObjectEXT():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension(_EXTENSION_NAME)
Пример #57
0
def glInitFragmentShaderATI():
    """Return boolean indicating whether this extension is available"""
    from OpenGL import extensions
    return extensions.hasGLExtension(_EXTENSION_NAME)
Пример #58
0
def glInitGlobalAlphaSUN():
	'''Return boolean indicating whether this extension is available'''
	return extensions.hasGLExtension( EXTENSION_NAME )
Пример #59
0
def glInitReadFormatOES():
    '''Return boolean indicating whether this extension is available'''
    return extensions.hasGLExtension(EXTENSION_NAME)
Пример #60
0
def glInitFogFunctionSGIS():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension(EXTENSION_NAME)