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, string)
Creates a render texture and populates metadata from the given source texture resource.
public RenderTexture(TextureTarget target, Texture data, string label)Parameters
target TextureTarget
OpenGL texture target.
data Texture
Source texture resource providing dimensions, mip count, spritesheet data and radiance harmonics.
label string
Label string visible in graphics debuggers.
RenderTexture(TextureTarget, int, int, int, int, string)
Creates a render texture with explicit dimension and mip level metadata.
public RenderTexture(TextureTarget target, int width, int height, int depth, int mipcount, string label)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.
label string
Label string visible in graphics debuggers.
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, or 0 once has been called.
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
RadianceCoefficients
Gets the baked radiance of each cube map in this array as an L2 spherical harmonic, 9 coefficients per channel stored planar, 27 per cube map. Null unless the source texture carried them.
public float[]? RadianceCoefficients { get; }Property Value
float[]?
Reflectivity
Gets 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, ImageFormat, string, bool)
Creates a 2D texture with immutable storage, optionally allocating a reduced mip chain sized by .
public static RenderTexture Create(int width, int height, ImageFormat format, string label, bool mips = false)Parameters
width int
Texture width in texels.
height int
Texture height in texels.
format ImageFormat
Internal pixel format.
label string
Label string visible in graphics debuggers.
mips bool
When true, allocates a reduced mip chain (see ) rather than a single level.
Returns
The newly created render texture.
Create(int, int, ImageFormat, int, string)
Creates a 2D texture with immutable storage and an explicit mip count.
public static RenderTexture Create(int width, int height, ImageFormat format, int mipCount, string label)Parameters
width int
Texture width in texels.
height int
Texture height in texels.
format ImageFormat
Internal pixel format.
mipCount int
Number of mip levels to allocate.
label string
Label string visible in graphics debuggers.
Returns
The newly created render texture.
Create3D(TextureTarget, int, int, int, ImageFormat, int, string, bool)
Creates a texture with immutable three dimensional storage.
public static RenderTexture Create3D(TextureTarget target, int width, int height, int depth, ImageFormat format, int mipCount, string label, bool srgb = false)Parameters
target TextureTarget
width int
height int
depth int
format ImageFormat
mipCount int
label string
srgb bool
Returns
The newly created render texture.
CreateView(ImageFormat, string, int, int, int, int)
Creates a texture view that reinterprets a subrange of this texture's storage.
public RenderTexture CreateView(ImageFormat format, string label, int minLevel = 0, int numLevels = 1, int minLayer = 0, int numLayers = 1)Parameters
format ImageFormat
The reinterpreted pixel format for the view.
label string
Label string visible in graphics debuggers.
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.
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(RsTextureAddressMode)
Sets one addressing mode for all relevant texture dimensions.
public void SetWrapMode(RsTextureAddressMode mode)Parameters
mode RsTextureAddressMode
The addressing mode to apply.
SetWrapMode(RsTextureAddressMode, RsTextureAddressMode, RsTextureAddressMode)
Sets the addressing mode per texture dimension, skipping the ones this texture does not have.
public void SetWrapMode(RsTextureAddressMode s, RsTextureAddressMode t, RsTextureAddressMode r)Parameters
Addressing mode across the width.
Addressing mode across the height.
Addressing mode across the depth.

