Garry's Mod Wiki


  ITexture GetRenderTargetEx( string name, number width, number height, number sizeMode, number depthMode, number textureFlags, number rtFlags, number imageFormat )


Gets (or creates if it does not exist) the rendertarget with the given name, this function allows to adjust the creation of a rendertarget more than GetRenderTarget.

See also render.PushRenderTarget and render.SetRenderTarget.


1 string name
The internal name of the render target.
The name is treated like a path and gets its extension discarded.
"name.1" and "name.2" are considered the same name and will result in the same render target being reused.
2 number width
The width of the render target, must be power of 2.
3 number height
The height of the render target, must be power of 2.
4 number sizeMode
Bitflag that influences the sizing of the render target, see RT_SIZE enum.
5 number depthMode
Bitflag that determines the depth buffer usage of the render target MATERIAL_RT_DEPTH enum.
PNG's may not render to non MATERIAL_RT_DEPTH_NONE RenderTargets
6 number textureFlags
Bitflag that configurates the texture, see TEXTUREFLAGS enum.

List of flags can also be found on the Valve's Developer Wiki:

7 number rtFlags
Flags that controll the HDR behaviour of the render target, see CREATERENDERTARGETFLAGS enum.
8 number imageFormat
Image format, see IMAGE_FORMAT enum.
Some additional image formats are accepted, but don't have enums. See VTF Enumerations.


1 ITexture
The new render target.