GLSL low level compiled shader object - this class is used to get at the linked program object and provide an interface for GLRenderSystem calls. GLSL does not provide access to the low level code of the shader so this class is really just a dummy place holder. GLSL uses a program object to represent the active vertex and fragment programs used but Axiom materials maintain seperate instances of the active vertex and fragment programs which creates a small problem for GLSL integration. The GLSLGpuProgram class provides the interface between the GLSLLinkProgramManager , GLRenderSystem, and the active GLSLProgram instances.
Inheritance: GLGpuProgram
Exemple #1
0
 /// <summary>
 ///		Default constructor.
 /// </summary>
 public GLSLLinkProgram(GLSLGpuProgram vertexProgram, GLSLGpuProgram geometryProgram, GLSLGpuProgram fragmentProgram)
 {
     this.vertexProgram        = vertexProgram;
     this.geometryProgram      = geometryProgram;
     this.fragmentProgram      = fragmentProgram;
     this.uniformRefsBuilt     = false;
     this.linked               = false;
     this.triedToLinkAndFailed = false;
 }
        /// <summary>
        ///		Set the active vertex shader for the next rendering state.
        /// </summary>
        /// <remarks>
        ///		The active program object will be cleared.
        ///		Normally called from the GLSLGpuProgram.BindProgram and UnbindProgram methods
        /// </remarks>
        /// <param name="vertexProgram"></param>
        public void SetActiveVertexShader(GLSLGpuProgram vertexProgram)
        {
            if (vertexProgram != this.activeVertexProgram)
            {
                this.activeVertexProgram = vertexProgram;

                // active link program is no longer valid
                this.activeLinkProgram = null;

                // change back to fixed pipeline
                Gl.glUseProgramObjectARB(0);
            }
        }
        /// <summary>
        ///		Set the active geometry shader for the next rendering state.
        /// </summary>
        /// <remarks>
        ///		The active program object will be cleared.
        ///		Normally called from the GLSLGpuProgram.BindProgram and UnbindProgram methods
        /// </remarks>
        /// <param name="vertexProgram"></param>
        public void SetActiveGeometryShader(GLSLGpuProgram geometryProgram)
        {
            if (geometryProgram != this.activeGeometryProgram)
            {
                this.activeGeometryProgram = geometryProgram;

                // active link program is no longer valid
                this.activeLinkProgram = null;

                // change back to fixed pipeline
                Gl.glUseProgramObjectARB(0);
            }
        }
        /// <summary>
        ///		Set the active fragment shader for the next rendering state.
        /// </summary>
        /// <remarks>
        ///		The active program object will be cleared.
        ///		Normally called from the GLSLGpuProgram.BindProgram and UnbindProgram methods
        /// </remarks>
        /// <param name="fragmentProgram"></param>
        public void SetActiveFragmentShader(GLSLGpuProgram fragmentProgram)
        {
            if (fragmentProgram != this.activeFragmentProgram)
            {
                this.activeFragmentProgram = fragmentProgram;

                // active link program is no longer valid
                this.activeLinkProgram = null;

                // change back to fixed pipeline
                Gl.glUseProgramObjectARB(0);
            }
        }
Exemple #5
0
 protected override void CreateLowLevelImpl()
 {
     assemblerProgram = new GLSLGpuProgram(this);
 }
Exemple #6
0
		protected override void CreateLowLevelImpl()
		{
			assemblerProgram = new GLSLGpuProgram( this );
		}
        /// <summary>
        ///		Set the active vertex shader for the next rendering state.
        /// </summary>
        /// <remarks>
        ///		The active program object will be cleared.
        ///		Normally called from the GLSLGpuProgram.BindProgram and UnbindProgram methods
        /// </remarks>
        /// <param name="vertexProgram"></param>
        public void SetActiveVertexShader(GLSLGpuProgram vertexProgram)
        {
            if(vertexProgram != activeVertexProgram) {
                activeVertexProgram = vertexProgram;

                // active link program is no longer valid
                activeLinkProgram = null;

                // change back to fixed pipeline
                Gl.glUseProgramObjectARB(0);
            }
        }
        /// <summary>
        ///		Set the active fragment shader for the next rendering state.
        /// </summary>
        /// <remarks>
        ///		The active program object will be cleared.
        ///		Normally called from the GLSLGpuProgram.BindProgram and UnbindProgram methods
        /// </remarks>
        /// <param name="fragmentProgram"></param>
        public void SetActiveFragmentShader(GLSLGpuProgram fragmentProgram)
        {
            if(fragmentProgram != activeFragmentProgram) {
                activeFragmentProgram = fragmentProgram;

                // active link program is no longer valid
                activeLinkProgram = null;

                // change back to fixed pipeline
                Gl.glUseProgramObjectARB(0);
            }
        }
		/// <summary>
		///		Set the active geometry shader for the next rendering state.
		/// </summary>
		/// <remarks>
		///		The active program object will be cleared.
		///		Normally called from the GLSLGpuProgram.BindProgram and UnbindProgram methods
		/// </remarks>
		/// <param name="vertexProgram"></param>
		public void SetActiveGeometryShader( GLSLGpuProgram geometryProgram )
		{
            if (geometryProgram != activeGeometryProgram)
			{
                activeGeometryProgram = geometryProgram;

				// active link program is no longer valid
				activeLinkProgram = null;

				// change back to fixed pipeline
				Gl.glUseProgramObjectARB( 0 );
			}
		}