Duality.Resources.ShaderProgram.AttachShaders C# (CSharp) Method

AttachShaders() public method

Attaches the specified VertexShader">Vertex- and
public AttachShaders ( ContentRef v, ContentRef f, ContentRef g = newContentRef<GeometryShader>() ) : void
v ContentRef
f ContentRef
g ContentRef
return void
        public void AttachShaders(ContentRef<VertexShader> v, ContentRef<FragmentShader> f, ContentRef<GeometryShader> g = new ContentRef<GeometryShader>())
        {
            DualityApp.GuardSingleThreadState();

            if (this.glProgramId == 0)	this.glProgramId = GL.CreateProgram();
            else						this.DetachShaders();

            this.compiled = false;
            this.vert = v;
            this.frag = f;
            this.geom = g;

            // Assure all shaders are compiled
            if (this.vert.IsAvailable) this.vert.Res.Compile();
            if (this.frag.IsAvailable) this.frag.Res.Compile();
            if (this.geom.IsAvailable) this.geom.Res.Compile();

            // Attach all shaders
            if (this.vert.IsAvailable) GL.AttachShader(this.glProgramId, this.vert.Res.OglShaderId);
            if (this.frag.IsAvailable) GL.AttachShader(this.glProgramId, this.frag.Res.OglShaderId);
            if (this.geom.IsAvailable) GL.AttachShader(this.glProgramId, this.geom.Res.OglShaderId);
        }

Same methods

ShaderProgram::AttachShaders ( ) : void

Usage Example

Esempio n. 1
0
        protected override void OnCopyDataTo(object target, ICloneOperation operation)
        {
            base.OnCopyDataTo(target, operation);
            ShaderProgram targetShader = target as ShaderProgram;

            targetShader.AttachShaders();
            targetShader.Compile();
        }
All Usage Examples Of Duality.Resources.ShaderProgram::AttachShaders