示例#1
0
 /// <summary>
 /// Binds the uniform's <see cref="Texture"/> to the specified <see cref="TextureUnit"/> for a shader program. Is called before the draw call.
 /// </summary>
 /// <param name="program">The program.</param>
 public override void Set(ShaderProgram program)
 {
     // for explanation on how textures are set, review: http://www.opentk.com/node/2559
     GL.ActiveTexture(this.Target);
     GL.BindTexture(TextureTarget.Texture2D, this.Texture);
     GL.Uniform1(program.GetUniformLocation(this.name), this.Target - TextureUnit.Texture0);
 }
示例#2
0
 /// <summary>
 /// Sets the attribute for a specific program.
 /// </summary>
 /// <param name="program">The program.</param>
 public void setAttribute(ShaderProgram program)
 {
     int index = program.GetAttributeLocation(this.name);
     if (index == -1)
         return;
     GL.EnableVertexAttribArray(index);
     GL.VertexAttribPointer(index, this.size, this.type,
         this.normalize, this.stride, this.offset);
 }
 public override void UnSet(ShaderProgram program)
 {
     this.unset(program);
 }
 public override void Set(ShaderProgram program)
 {
     this.set(program);
 }
 /// <summary>
 /// Sets depth masking to default(enabled) after draw call.
 /// </summary>
 /// <param name="program">The program.</param>
 public override void UnSet(ShaderProgram program)
 {
     GL.DepthMask(true);
 }
 /// <summary>
 /// Sets the depth masking setting for a shader program. Is called before the draw call.
 /// </summary>
 /// <param name="program">The program.</param>
 public override void Set(ShaderProgram program)
 {
     GL.DepthMask(this.maskDepth);
 }
示例#7
0
 /// <summary>
 /// Sets the <see cref="Vector3"/> uniform for a shader program. Is called before the draw call.
 /// </summary>
 /// <param name="program">The program.</param>
 public override void Set(ShaderProgram program)
 {
     GL.Uniform3(program.GetUniformLocation(this.name), this.Vector);
 }
示例#8
0
 /// <summary>
 /// Unsets the setting for a shader program. Is called after the draw call, if needsUnsetting was set to true in constructor.
 /// </summary>
 /// <param name="program">The program.</param>
 public virtual void UnSet(ShaderProgram program) { }
示例#9
0
 /// <summary>
 /// Sets the setting for a shader program. Is called before the draw call.
 /// </summary>
 /// <param name="program">The program.</param>
 public abstract void Set(ShaderProgram program);
示例#10
0
 /// <summary>
 /// Sets the shader program used to render this surface.
 /// </summary>
 /// <param name="program">The program.</param>
 public void SetShaderProgram(ShaderProgram program)
 {
     this.program = program;
     this.onNewShaderProgram();
 }
示例#11
0
 /// <summary>
 /// Sets the <see cref="float"/> uniform for a shader program. Is called before the draw call.
 /// </summary>
 /// <param name="program">The program.</param>
 public override void Set(ShaderProgram program)
 {
     GL.Uniform1(program.GetUniformLocation(this.name), this.Float);
 }
示例#12
0
 /// <summary>
 /// Disables blending after draw call.
 /// </summary>
 /// <param name="program">The program.</param>
 public override void UnSet(ShaderProgram program)
 {
     GL.Disable(EnableCap.Blend);
 }
示例#13
0
 /// <summary>
 /// Enables blending and sets the blend function for a shader program. Is called before the draw call.
 /// </summary>
 /// <param name="program">The program.</param>
 public override void Set(ShaderProgram program)
 {
     GL.Enable(EnableCap.Blend);
     GL.BlendFunc(this.srcBlend, this.destBlend);
     GL.BlendEquation(this.equation);
 }
示例#14
0
 /// <summary>
 /// Sets the <see cref="Matrix4"/> uniform for a shader program. Is called before the draw call.
 /// </summary>
 /// <param name="program">The program.</param>
 override public void Set(ShaderProgram program)
 {
     GL.UniformMatrix4(program.GetUniformLocation(this.name), false, ref this.Matrix);
 }
示例#15
0
 /// <summary>
 /// Sets the <see cref="Color"/> uniform for a shader program. Is called before the draw call.
 /// </summary>
 /// <param name="program">The program.</param>
 public override void Set(ShaderProgram program)
 {
     GL.Uniform4(program.GetUniformLocation(this.name), this.Color.AsRGBAVector);
 }
示例#16
0
 /// <summary>
 /// Sets the <see cref="Vector4"/> uniform for a shader program. Is called before the draw call.
 /// </summary>
 /// <param name="program">The program.</param>
 public override void Set(ShaderProgram program)
 {
     GL.Uniform4(program.GetUniformLocation(this.name), this.Vector);
 }