public GLDepthBuffer( PoolId poolId, GLRenderSystem renderSystem, GLContext creatorContext, GLRenderBuffer depth, GLRenderBuffer stencil, int width, int height, int fsaa, int multiSampleQuality, bool manual) : base( poolId, 0, width, height, fsaa, "", manual ) { }
internal GLPBRTTManager( BaseGLSupport glSupport, RenderTarget target ) : base( glSupport ) { _glSupport = glSupport; _mainWindow = target; _mainGLContext = (GLContext)target.GetCustomAttribute( "GLCONTEXT" ); }
private void _switchContext( GLContext context ) { // Unbind GPU programs and rebind to new context later, because // scene manager treat render system as ONE 'context' ONLY, and it // cached the GPU programs using state. if ( currentVertexProgram != null ) currentVertexProgram.Unbind(); if ( currentFragmentProgram != null ) currentFragmentProgram.Unbind(); if (currentGeometryProgram != null) currentGeometryProgram.Unbind(); // Disable lights for (var i = 0 ; i < _currentLights; i++ ) { SetGLLight( i, null ); lights[ i ] = null; } _currentLights = 0; // Disable textures DisableTextureUnitsFrom(0); // It's ready to switching _currentContext.EndCurrent(); _currentContext = context; _currentContext.SetCurrent(); // Check if the context has already done one-time initialisation if ( !_currentContext.Initialized ) { OneTimeContextInitialization(); _currentContext.Initialized = true; } // Rebind GPU programs to new context if ( currentVertexProgram != null ) currentVertexProgram.Bind(); if ( currentFragmentProgram != null ) currentFragmentProgram.Bind(); if (currentGeometryProgram != null) currentGeometryProgram.Bind(); // Must reset depth/color write mask to according with user desired, otherwise, // clearFrameBuffer would be wrong because the value we are recorded may be // difference with the really state stored in GL context. Gl.glDepthMask( depthWrite ? 1 : 0 ); // Tao 2.0 Gl.glColorMask( ColorWrite[ 0 ], ColorWrite[ 1 ], ColorWrite[ 2 ], ColorWrite[ 3 ] ); Gl.glStencilMask( stencilMask ); }
internal void UnRegisterContext( GLContext context ) { if ( _currentContext == context ) { // Change the context to something else so that a valid context // remains active. When this is the main context being unregistered, // we set the main context to 0. if ( _currentContext != _mainContext ) { _switchContext( _mainContext ); } else { // No contexts remain _currentContext.EndCurrent(); _currentContext = null; _mainContext = null; } } }
public GLDepthBuffer(PoolId poolId, GLRenderSystem renderSystem, GLContext creatorContext, GLRenderBuffer depth, GLRenderBuffer stencil, int width, int height, int fsaa, int multiSampleQuality, bool manual) : base(poolId, 0, width, height, fsaa, "", manual) { }