Class RenderTexture
Namespace: ValveResourceFormat.Renderer
Assembly: Renderer.dll
OpenGL texture object with metadata for dimensions and filtering configuration.
public class RenderTextureInheritance
Constructors
RenderTexture(TextureTarget, Texture)
Creates a render texture and populates metadata from the given source texture resource.
public RenderTexture(TextureTarget target, Texture data)Parameters
target TextureTarget
OpenGL texture target.
data Texture
Source texture resource providing dimensions, mip count, and spritesheet data.
RenderTexture(TextureTarget, int, int, int, int)
Creates a render texture with explicit dimension and mip level metadata.
public RenderTexture(TextureTarget target, int width, int height, int depth, int mipcount)Parameters
target TextureTarget
OpenGL texture target.
width int
Width in texels.
height int
Height in texels.
depth int
Depth or array layer count.
mipcount int
Number of mip levels.
RenderTexture(int, TextureTarget)
Wraps an existing OpenGL texture handle without taking ownership of its storage.
public RenderTexture(int handle, TextureTarget target)Parameters
handle int
Existing OpenGL texture handle.
target TextureTarget
OpenGL texture target.
Properties
Depth
Gets the depth of the texture (number of slices for 3D or array textures).
public int Depth { get; }Property Value
Handle
Gets the OpenGL texture object handle.
public int Handle { get; }Property Value
Height
Gets the height of the texture in texels.
public int Height { get; }Property Value
NumMipLevels
Gets the number of mip levels.
public int NumMipLevels { get; }Property Value
Reflectivity
Gets or sets the average color reflectivity used for environment lighting calculations.
public Vector4 Reflectivity { get; }Property Value
SpriteSheetData
Gets optional spritesheet layout data when the texture is a sprite atlas.
public Texture.SpritesheetData? SpriteSheetData { get; }Property Value
Target
Gets the OpenGL texture target (e.g. Texture2D, TextureCubeMap).
public TextureTarget Target { get; }Property Value
TextureTarget
Width
Gets the width of the texture in texels.
public int Width { get; }Property Value
Methods
AttachToFramebuffer(Framebuffer, FramebufferAttachment, int)
Attaches the specified mip level of this texture to a framebuffer attachment point.
public void AttachToFramebuffer(Framebuffer framebuffer, FramebufferAttachment attachment, int mipLevel)Parameters
framebuffer Framebuffer
Target framebuffer.
attachment FramebufferAttachment
Attachment point (e.g. color attachment 0, depth).
mipLevel int
Mip level to attach.
Create(int, int, SizedInternalFormat, bool)
Creates a 2D texture with immutable storage, optionally generating a full mip chain.
public static RenderTexture Create(int width, int height, SizedInternalFormat format = SizedInternalFormat.Rgba8, bool mips = false)Parameters
width int
Texture width in texels.
height int
Texture height in texels.
format SizedInternalFormat
Internal pixel format.
mips bool
When true, allocates a full mip chain.
Returns
The newly created render texture.
Create(int, int, SizedInternalFormat, int)
Creates a 2D texture with immutable storage and an explicit mip count.
public static RenderTexture Create(int width, int height, SizedInternalFormat format, int mipCount)Parameters
width int
Texture width in texels.
height int
Texture height in texels.
format SizedInternalFormat
Internal pixel format.
mipCount int
Number of mip levels to allocate.
Returns
The newly created render texture.
CreateView(PixelInternalFormat, int, int, int, int)
Creates a texture view that reinterprets a subrange of this texture's storage.
public RenderTexture CreateView(PixelInternalFormat internalFormat, int minLevel = 0, int numLevels = 1, int minLayer = 0, int numLayers = 1)Parameters
internalFormat PixelInternalFormat
The reinterpreted pixel format for the view.
minLevel int
First mip level visible through the view.
numLevels int
Number of mip levels visible through the view.
minLayer int
First array layer visible through the view.
numLayers int
Number of array layers visible through the view.
Returns
A new wrapping the view.
Delete()
Deletes the underlying OpenGL texture object.
public void Delete()MaxMipCount(int, int)
Calculates a reasonable mip count for a texture of the given dimensions.
public static int MaxMipCount(int width, int height)Parameters
width int
Texture width in texels.
height int
Texture height in texels.
Returns
Number of mip levels to use.
SetBaseMaxLevel(int, int)
Sets the base and maximum mip level accessible through this texture.
public void SetBaseMaxLevel(int baseLevel, int maxLevel)Parameters
baseLevel int
Lowest mip level index.
maxLevel int
Highest mip level index.
SetFiltering(TextureMinFilter, TextureMagFilter)
Sets the minification and magnification filters.
public void SetFiltering(TextureMinFilter min, TextureMagFilter mag)Parameters
min TextureMinFilter
Minification filter.
mag TextureMagFilter
Magnification filter.
SetLabel(string)
Assigns a debug label to the OpenGL texture object.
public void SetLabel(string label)Parameters
label string
Label string visible in graphics debuggers.
SetParameter(TextureParameterName, int)
Sets a single integer texture parameter.
public void SetParameter(TextureParameterName parameter, int value)Parameters
parameter TextureParameterName
The parameter name to set.
value int
The integer value to assign.
SetWrapMode(TextureWrapMode)
Sets the wrap mode for all relevant texture dimensions.
public void SetWrapMode(TextureWrapMode wrap)Parameters
wrap TextureWrapMode
The wrap mode to apply.

