public override void Shutdown() { //Deleting the GLSL program factory if ( this.glslESProgramFactory != null ) { //Remove from manager safely if ( HighLevelGpuProgramManager.Instance != null ) { HighLevelGpuProgramManager.Instance.RemoveFactory( this.glslESProgramFactory ); } this.glslESProgramFactory.Dispose(); this.glslESProgramFactory = null; } //Deleting the GLSL program factory if ( this.glslESCgProgramFactory != null ) { if ( HighLevelGpuProgramManager.Instance != null ) { HighLevelGpuProgramManager.Instance.RemoveFactory( this.glslESCgProgramFactory ); } this.glslESCgProgramFactory.Dispose(); this.glslESCgProgramFactory = null; } //Deleting the GPU program manager and hardware buffer manager. Has to be done before the glSupport.Stop() if ( null != this.gpuProgramManager ) { this.gpuProgramManager.Dispose(); this.gpuProgramManager = null; } this.hardwareBufferManager = null; this.rttManager = null; if ( null != this.textureManager ) { textureManager.Dispose(); textureManager = null; } base.Shutdown(); this.glSupport.Stop(); this.glInitialized = false; }
public GLES2RenderSystem() { this.depthWrite = true; this.stencilMask = 0xFFFFFFFF; this.gpuProgramManager = null; this.glslESProgramFactory = null; this.hardwareBufferManager = null; this.rttManager = null; int i; LogManager.Instance.Write( this.Name + " created." ); this.renderAttribsBound = new List<int>( 100 ); #if RTSHADER_SYSTEM_BUILD_CORE_SHADERS enableFixedPipeline = false; #endif this.CreateGlSupport(); this.worldMatrix = Matrix4.Identity; this.viewMatrix = Matrix4.Identity; this.glSupport.AddConfig(); this.colorWrite[ 0 ] = this.colorWrite[ 1 ] = this.colorWrite[ 2 ] = this.colorWrite[ 3 ] = true; for ( i = 0; i < Config.MaxTextureLayers; i++ ) { //Dummy value this.textureCoordIndex[ i ] = 99; this.textureTypes[ i ] = 0; } activeRenderTarget = null; this.currentContext = null; this.mainContext = null; this.glInitialized = false; this.minFilter = FilterOptions.Linear; this.mipFilter = FilterOptions.Point; this.currentVertexProgram = null; this.currentFragmentProgram = null; //todo //polygonMode = GL_FILL; }
public override void InitializeFromRenderSystemCapabilities( RenderSystemCapabilities caps, RenderTarget primary ) { if ( caps.RendersystemName != this.Name ) { throw new AxiomException( "Trying to initialize GLES2RenderSystem from RenderSystemCapabilities that do not support OpenGL ES" ); } this.gpuProgramManager = new GLES2GpuProgramManager(); this.glslESProgramFactory = new GLSLES.GLSLESProgramFactory(); HighLevelGpuProgramManager.Instance.AddFactory( this.glslESProgramFactory ); //todo: check what can/can't support cg this.glslESCgProgramFactory = new GLSLES.GLSLESCgProgramFactory(); HighLevelGpuProgramManager.Instance.AddFactory( this.glslESCgProgramFactory ); //Set texture the number of texture units this.fixedFunctionTextureUnits = caps.TextureUnitCount; //Use VBO's by default this.hardwareBufferManager = new GLES2HardwareBufferManager(); //Create FBO manager LogManager.Instance.Write( "GL ES 2: Using FBOs for rendering to textures" ); this.rttManager = new GLES2FBOManager(); caps.SetCapability( Graphics.Capabilities.RTTSerperateDepthBuffer ); Log defaultLog = LogManager.Instance.DefaultLog; if ( defaultLog != null ) { caps.Log( defaultLog ); } textureManager = new GLES2TextureManager( this.glSupport ); this.glInitialized = true; }