static class Graphics

book_4_sparkGenerated
code_blocksInput

Description

The Graphics class in the Sandbox namespace is used to render to the screen using your Graphics Card. It provides a variety of static methods and properties to facilitate rendering operations, such as setting up lighting, grabbing frame textures, drawing models, and more. This class is designed to be used in a static context, meaning you do not need to instantiate it to use its functionality.

Members

Static Properties

Member NameSummary
IsActiveIf true, then we're currently rendering and you are safe to use the contents of this class.
LayerTypeThe current layer type. Useful to determine whether you're meant to be drawing opaque, transparent, or shadow.
ViewportIn pixel size, where are we rendering to?
AttributesAccess to the current render context's attributes. These are used to set attributes in materials/shaders.
CameraPositionThe camera position of the currently rendering view.
RenderTargetGet or set the current render target. Setting this will bind the render target and change the viewport to match it.

Static Methods

Member NameSummary
SetupLightingSets up lighting for a given scene object with specified render attributes.
GrabFrameTextureGrabs a frame texture with the specified name and render attributes, optionally with mipmaps.
GrabDepthTextureGrabs a depth texture with the specified name and render attributes, optionally with mipmaps.
ClearClears the current render target with specified color and depth options.
RenderToTextureRenders a scene camera to a specified texture.
CopyTextureCopies data from a source texture to a destination texture.
DrawDraws vertices or indexed vertices using a specified material and render attributes.
BlitBlits a material to the current render target using specified render attributes.
RenderRenders a scene object with optional transform, color, and material.
DrawQuadDraws a quad with specified material and color attributes.
DrawTextDraws text at a specified position with given font and color attributes.
MeasureTextMeasures the size of text with specified font attributes.
DrawIconDraws an icon at a specified position with given color and alignment.
DrawRoundedRectangleDraws a rounded rectangle with specified color and border attributes.
DrawModelDraws a model with specified transform and render attributes.
DrawModelInstancedDraws multiple instances of a model with specified transforms and render attributes.
DrawModelInstancedIndirectDraws model instances using indirect parameters from a buffer.
GenerateMipMapsGenerates mipmaps for a texture using a specified downsample method.
ResourceBarrierTransitionTransitions a resource's state for a texture or buffer.