GLSL Hacker
FEATURES DOWNLOAD GALLERY BLOG LEARN



Back to Reference Guide Index

gh_render_target Library

Description

gh_render_target is the module that manages render targets. A render target is used in render to texture and post processing effects.

Number of functions: 13



gh_render_target.create

Description

Creates a render target.

Languages

Lua - Python

Parameters

  • width, height [INTEGER]: size of the render target.

    Return Values

  • rt_id [INTEGER]: render target identifier

    Code sample


    rt_id = gh_render_target.create(2048, 2048)



    gh_render_target.create_v2

    Description

    Creates a render target with multiple render targets (MRTs).

    Languages

    Lua - Python

    Parameters

  • width, height [INTEGER]: size of the render target.
  • num_color_targets [INTEGER]: number of color targets.

    Return Values

  • rt_id [INTEGER]: render target identifier

    Code sample


    rt_id = gh_render_target.create_v2(2048, 2048, 4)



    gh_render_target.create_ex

    Description

    Creates a render target.

    Languages

    Lua - Python

    Parameters

  • width, height [INTEGER]: size of the render target.
  • pixel_format [INTEGER]: pixel format of color target.
  • linear_filtering [INTEGER]: performs linear filtering (1) or not (0).
  • msaa_samples [INTEGER]: number of antialiasing samples.

    Return Values

  • rt_id [INTEGER]: render target identifier

    Code sample


    PF_U8_RGB = 1
    PF_U8_BGR = 2
    PF_U8_RGBA = 3
    PF_U8_BGRA = 4
    PF_F32_RGB = 5
    PF_F32_RGBA = 6
    PF_F32_R = 7
    linear_filtering = 1
    msaa_samples = 4
    rt_id = gh_render_target.create_ex(2048, 2048, PF_F32_RGBA, linear_filtering, msaa_samples)



    gh_render_target.create_ex_v3

    Description

    Creates a render target with multiple render targets (MRTs).

    Languages

    Lua - Python

    Parameters

  • width, height [INTEGER]: size of the render target.
  • num_color_targets [INTEGER]: number of color targets.
  • pixel_format [INTEGER]: pixel format of color target.
  • linear_filtering [INTEGER]: performs linear filtering (1) or not (0).
  • clamp_addressing [INTEGER]: enables clamping of the texture to the borders or not.
  • msaa_samples [INTEGER]: number of antialiasing samples.

    Return Values

  • rt_id [INTEGER]: render target identifier

    Code sample


    num_color_targets = 4
    PF_U8_RGB = 1
    PF_U8_BGR = 2
    PF_U8_RGBA = 3
    PF_U8_BGRA = 4
    PF_F32_RGB = 5
    PF_F32_RGBA = 6
    PF_F32_R = 7
    PF_F16_RGB = 8
    PF_F16_RGBA = 9
    PF_F16_R = 10
    PF_U8_R = 11
    PF_U8_RG = 12
    linear_filtering = 1
    clamp_addressing = 1
    msaa_samples = 4
    rt_id = gh_render_target.create_ex_v3(2048, 2048, num_color_targets, PF_F32_RGBA, linear_filtering, msaa_samples)



    gh_render_target.create_rb

    Description

    Creates a color depth render buffer.

    Languages

    Lua - Python

    Parameters

  • width, height [INTEGER]: size of the render target.
  • pixel_format [INTEGER]: pixel format of color target.
  • msaa_samples [INTEGER]: number of antialiasing samples.

    Return Values

  • rt_id [INTEGER]: render target identifier

    Code sample


    PF_U8_RGB = 1
    PF_U8_BGR = 2
    PF_U8_RGBA = 3
    PF_U8_BGRA = 4
    PF_F32_RGB = 5
    PF_F32_RGBA = 6
    PF_F32_R = 7
    PF_F16_RGB = 8
    PF_F16_RGBA = 9
    PF_F16_R = 10
    PF_U8_R = 11
    PF_U8_RG = 12
    msaa_samples = 4
    rt_id = gh_render_target.create_rb(2048, 2048, PF_F32_RGBA, msaa_samples)



    gh_render_target.create_depth

    Description

    Creates a depth only render target.

    Languages

    Lua - Python

    Parameters

  • width, height [INTEGER]: size of the render target.
  • linear_filtering [INTEGER]: performs linear filtering (1) or not (0).

    Return Values

  • rt_id [INTEGER]: render target identifier

    Code sample


    rt_id = gh_render_target.create_depth(2048, 2048, 0)



    gh_render_target.create_cubemap

    Description

    Creates a depth only render target.

    Languages

    Lua - Python

    Parameters

  • size [INTEGER]: size of the cubemap faces.
  • create_color_cubemap [INTEGER]: specifies the creation of a color target.
  • depth_conf [INTEGER]: depth buffer configuration: 0 (no depth), 1 (depth_cubemap), 2 (depth_renderbuffer), 3 (depth_texture).
  • pixel_format [INTEGER]: pixel format of color target.
  • linear_filtering [INTEGER]: performs linear filtering (1) or not (0).
  • clamp_addressing [INTEGER]: enables clamping of the texture to the borders or not.

    Return Values

  • rt_id [INTEGER]: render target identifier

    Code sample


    PF_U8_RGBA = 3
    rt_id = gh_render_target.create_cubemap(1024, 1, 1, PF_U8_RGBA, 1, 1)



    gh_render_target.cubemap_set_draw_face

    Description

    Specifies the target of drawing commands for a cubemap render target.

    Languages

    Lua - Python

    Parameters

  • rt_id [INTEGER]: render target identifier
  • face [INTEGER]: face of the cubemap (0 to 5).

    Return Values

    This function has no return value(s).

    Code sample


    gh_render_target.cubemap_set_draw_face(rt_id, face)



    gh_render_target.kill

    Description

    Kills (cleanup + free resources) a render target.

    Languages

    Lua - Python

    Parameters

  • rt_id [INTEGER]: render target identifier.

    Return Values

    This function has no return value(s).

    Code sample


    gh_render_target.kill(rt_id)



    gh_render_target.bind

    Description

    Binds the render target.

    Languages

    Lua - Python

    Parameters

  • rt_id [INTEGER]: render target identifier.

    Return Values

    This function has no return value(s).

    Code sample


    gh_render_target.bind(rt_id)
    ...
    gh_render_target.bind(0) -- unbinds



    gh_render_target.resize

    Description

    Resizes a render target.

    Languages

    Lua - Python

    Parameters

  • rt_id [INTEGER]: render target identifier
  • width, height [INTEGER]: size of the render target.

    Return Values

    This function has no return value(s).

    Code sample


    gh_render_target.resize(rt_id, new_width, new_height)



    gh_render_target.resolve_multisampling

    Description

    Resolves multisampling.

    Languages

    Lua - Python

    Parameters

  • rt_src [INTEGER]: multisampled source render target.
  • rt_dst [INTEGER]: regular destination render target.

    Return Values

    This function has no return value(s).

    Code sample


    gh_render_target.resolve_multisampling(ms_rt, rt)



    gh_render_target.use_with_syphon

    Description

    Specifies that this render target can be a source for Syphon (Mac OSX only).

    Languages

    Lua - Python

    Parameters

  • rt_id [INTEGER]: render target identifier.

    Return Values

    This function has no return value(s).

    Code sample


    gh_render_target.use_with_syphon(rt)





    2013-2015 Geeks3D. All Rights Reserved.

    .:- G3D Network -:.