Class RenderContext
Orchestrates the software rendering pipeline.
public class RenderContext
- Inheritance
-
RenderContext
- Inherited Members
Remarks
RenderContext manages the rendering state and executes vertex and fragment shaders to produce pixels in a framebuffer.
Constructors
RenderContext(Framebuffer)
Creates a new render context with the specified framebuffer.
public RenderContext(Framebuffer framebuffer)
Parameters
framebufferFramebufferThe framebuffer to render into.
Properties
BlendEnabled
Gets or sets whether blending is enabled.
public bool BlendEnabled { get; set; }
Property Value
CullMode
Gets or sets the triangle cull mode (default is Back).
public CullMode CullMode { get; set; }
Property Value
DepthTestEnabled
Gets or sets whether depth testing is enabled.
public bool DepthTestEnabled { get; set; }
Property Value
Framebuffer
Gets the framebuffer associated with this render context.
public Framebuffer Framebuffer { get; }
Property Value
Topology
Gets or sets the primitive topology.
public PrimitiveTopology Topology { get; set; }
Property Value
Viewport
Gets or sets the viewport for coordinate transformation.
public Viewport Viewport { get; set; }
Property Value
Methods
ClearColor(Color4)
Clears the framebuffer color to the specified value.
public void ClearColor(Color4 color)
Parameters
colorColor4Color to clear to.
ClearDepth(float)
Clears the framebuffer depth to the specified value.
public void ClearDepth(float depth = 1)
Parameters
depthfloatDepth value to clear to (default 1.0).
Draw<TVertex, TVarying, TBindings>(VertexSource<TVertex>, IVertexShader<TVertex, TVarying, TBindings>, IFragmentShader<TVarying, FragmentOutput, TBindings>, TBindings)
Renders vertices through the specified vertex and fragment shaders.
public void Draw<TVertex, TVarying, TBindings>(VertexSource<TVertex> vertices, IVertexShader<TVertex, TVarying, TBindings> vertexShader, IFragmentShader<TVarying, FragmentOutput, TBindings> fragmentShader, TBindings bindings) where TVertex : unmanaged where TVarying : unmanaged where TBindings : unmanaged
Parameters
verticesVertexSource<TVertex>Source of vertex data.
vertexShaderIVertexShader<TVertex, TVarying, TBindings>Vertex shader implementation.
fragmentShaderIFragmentShader<TVarying, FragmentOutput, TBindings>Fragment shader implementation.
bindingsTBindingsShader bindings (uniforms, textures, etc.).
Type Parameters
TVertexThe vertex input type.
TVaryingThe varying data type (vertex output / fragment input).
TBindingsThe shader bindings type.