/// <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); }
/// <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); }
/// <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); }
/// <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) { }
/// <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);
/// <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(); }
/// <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); }
/// <summary> /// Disables blending after draw call. /// </summary> /// <param name="program">The program.</param> public override void UnSet(ShaderProgram program) { GL.Disable(EnableCap.Blend); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }