gh_renderer is the module that talks directly with the graphics hardware.
Number of functions: 60
Checks if a particular OpenGL extension is exposed.
if (gh_renderer.check_opengl_extension("GL_ARB_compute_shader") == 1) then
-- OpenGL 4.3 compute shaders are supported.
end
OpenGL: gets a capability value
GL_MAX_MESH_TOTAL_MEMORY_SIZE_NV = 38198
x = gh_renderer.gl_get_integerv_1i(GL_MAX_MESH_TOTAL_MEMORY_SIZE_NV)
OpenGL: gets a capability value
x, y, z, w = gh_renderer.gl_get_integerv_4i(capability)
OpenGL: gets a capability value by index.
GL_MAX_MESH_WORK_GROUP_SIZE_NV = 38203
capability = GL_MAX_MESH_WORK_GROUP_SIZE_NV
x = gh_renderer.gl_get_integeri_1i(capability, 0)
y = gh_renderer.gl_get_integeri_1i(capability, 1)
z = gh_renderer.gl_get_integeri_1i(capability, 2)
Clear the color buffer with a RGBA color.
This function has no return value(s).
gh_renderer.clear_color_buffer(0, 0, 0, 1)
Clear the color and depth buffers in the same call.
This function has no return value(s).
gh_renderer.clear_color_depth_buffers(r, g, b, a, z)
Clear the depth buffer.
This function has no return value(s).
z = 1.0
gh_renderer.clear_depth_buffer(z)
Sets the mask for the depth buffer (enables or disables writing to the depth buffer).
This function has no return value(s).
gh_renderer.set_depth_mask(0)
...
gh_renderer.set_depth_mask(1)
Sets the mask for the color buffer (enables or disables writing to the color buffer).
This function has no return value(s).
gh_renderer.set_color_mask(1, 0, 0, 1)
...
gh_renderer.set_color_mask(1, 1, 1, 1)
OpenGL / NVIDIA GPUs - returns properties related to conservative rasterization. See the GL_NV_conservative_raster extension for more details.
This function has no input parameter(s).
bias_xbits, bias_ybits, max_bias_bits = gh_renderer.conservative_rasterization_get_properties_nv()
OpenGL / NVIDIA GPUs - sets conservative rasterization params. See the GL_NV_conservative_raster extension for more details.
This function has no return value(s).
gh_renderer.conservative_rasterization_set_sub_pixel_precision_bias_nv(bias_xbits, bias_ybits)
Disables a rendering state.
This function has no return value(s).
--[[
States supported:
"GL_CLIP_DISTANCE0"
"GL_CLIP_DISTANCE1"
"GL_CLIP_DISTANCE2"
"GL_CLIP_DISTANCE3"
"GL_MULTISAMPLE"
"GL_CULL_FACE"
"GL_BLEND"
"GL_DEPTH_TEST"
"GL_SCISSOR_TEST"
"GL_TEXTURE_2D"
"GL_LIGHTING"
"GL_LIGHT0"
"GL_LIGHT1"
"GL_LIGHT2"
"GL_LIGHT3"
"GL_PROGRAM_POINT_SIZE"
"GL_CONSERVATIVE_RASTERIZATION_INTEL"
"GL_CONSERVATIVE_RASTERIZATION_NV"
"GL_MULTISAMPLE"
--]]
gh_renderer.disable_state("GL_CLIP_DISTANCE0")
Renders a progress bar. The progress bar percent is set with gh_utils.set_progress_bar_percent(). Both functions can be used in an INIT script to draw a progress bar while loading data.
This function has no return value(s).
gh_utils.set_progress_bar_percent(20)
gh_renderer.display_progress_bar()
...
... do some stuff
...
gh_utils.set_progress_bar_percent(60)
gh_renderer.display_progress_bar()
...
... do some stuff
...
gh_utils.set_progress_bar_percent(100)
gh_renderer.display_progress_bar()
Draws primitives (POINTS, LINES, TRIANGLES, TRIANGLE_STRIP, etc.). In GeeXLab this function is essentially used with attribute-less rendering.
This function has no return value(s).
PRIMITIVE_TRIANGLE = 0
PRIMITIVE_TRIANGLE_STRIP = 1
PRIMITIVE_LINE = 2
PRIMITIVE_LINE_STRIP = 3
PRIMITIVE_LINE_LOOP = 4
PRIMITIVE_POINT = 8
primitive_type = PRIMITIVE_TRIANGLE_STRIP
count = 4
start = 0
gh_renderer.draw_primitives(primitive_type, count, start)
Enables a rendering state.
This function has no return value(s).
--[[
States supported:
"GL_CLIP_DISTANCE0"
"GL_CLIP_DISTANCE1"
"GL_CLIP_DISTANCE2"
"GL_CLIP_DISTANCE3"
"GL_MULTISAMPLE"
"GL_SAMPLE_ALPHA_TO_COVERAGE"
"GL_SAMPLE_ALPHA_TO_ONE"
"GL_CULL_FACE"
"GL_BLEND"
"GL_DEPTH_TEST"
"GL_SCISSOR_TEST"
"GL_DEPTH_BOUNDS_TEST_EXT"
"GL_POLYGON_OFFSET_FILL"
"GL_DITHER"
"GL_TEXTURE_2D"
"GL_LIGHTING"
"GL_LIGHT0"
"GL_LIGHT1"
"GL_LIGHT2"
"GL_LIGHT3"
"GL_PROGRAM_POINT_SIZE"
"GL_POINT_SPRITE"
"GL_CONSERVATIVE_RASTERIZATION_INTEL"
"GL_CONSERVATIVE_RASTERIZATION_NV"
"GL_TEXTURE_CUBE_MAP_SEAMLESS"
--]]
gh_renderer.enable_state("GL_CLIP_DISTANCE0")
Gets the OpenGL version.
This function has no input parameter(s).
glversion = gh_renderer.get_api_version()
Gets OpenGL major version number.
This function has no input parameter(s).
glmajor = gh_renderer.get_api_version_major()
if (glmajor < 4) then
-- Tessellation not supported
end
Gets OpenGL minor version number.
This function has no input parameter(s).
glminor = gh_renderer.get_api_version_minor()
Gets a hardware capability.
--[[
Capabilities supported:
"GL_MAX_SUBROUTINES"
"GL_MAX_SUBROUTINE_UNIFORM_LOCATIONS"
"GL_MAX_VERTEX_ATTRIBS"
"GL_MAX_TEXTURE_SIZE"
"GL_MAX_TEXTURE_IMAGE_UNITS"
"GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS"
"GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS"
"GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS"
"GL_MAX_ARRAY_TEXTURE_LAYERS"
"GL_MAX_COLOR_ATTACHMENTS"
"GL_MAX_DRAW_BUFFERS"
"GL_MAX_VIEWPORT_DIMS"
"GL_MAX_SAMPLES"
"GL_MAX_VERTEX_STREAMS"
"GL_MAX_GEOMETRY_SHADER_INVOCATIONS"
"GL_MAX_PATCH_VERTICES"
"GL_MAX_TESS_GEN_LEVEL"
"GL_MAX_TRANSFORM_FEEDBACK_BUFFERS"
"GL_MAX_COMPUTE_WORK_GROUP_COUNT"
"GL_MAX_COMPUTE_WORK_GROUP_SIZE"
"GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS"
"GL_MAX_COMPUTE_SHARED_MEMORY_SIZE"
"GL_MAX_FRAMEBUFFER_WIDTH"
"GL_MAX_FRAMEBUFFER_WIDTH"
"GL_MAX_FRAMEBUFFER_HEIGHT"
"GL_MAX_FRAMEBUFFER_LAYERS"
"GL_MAX_FRAMEBUFFER_SAMPLES"
"GL_MAX_WIDTH"
"GL_MAX_HEIGHT"
"GL_MAX_DEPTH"
"GL_MAX_LAYERS"
"GL_MAX_COMBINED_DIMENSIONS"
"GL_MAX_VERTEX_ATTRIB_STRIDE"
"GL_MIN_MAP_BUFFER_ALIGNMENT"
"GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT"
"GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT"
"GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT"
"GL_MAX_UNIFORM_BUFFER_BINDINGS"
"GL_MAX_UNIFORM_BLOCK_SIZE"
"GL_MAX_VERTEX_UNIFORM_BLOCKS"
"GL_MAX_FRAGMENT_UNIFORM_BLOCKS"
"GL_MAX_GEOMETRY_UNIFORM_BLOCKS"
"GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS"
"GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS"
"GL_MAX_COMPUTE_UNIFORM_BLOCKS"
"GL_MAX_COMBINED_UNIFORM_BLOCKS"
"GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT"
"GL_MAX_SHADER_STORAGE_BLOCK_SIZE"
"GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS"
"GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS"
"GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS"
"GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS"
"GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS"
"GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS"
"GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS"
"GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS"
"GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE"
"GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS"
"GL_MAX_COMBINED_ATOMIC_COUNTER_BUFFERS"
"GL_MAX_VERTEX_ATOMIC_COUNTERS"
"GL_MAX_FRAGMENT_ATOMIC_COUNTERS"
"GL_MAX_GEOMETRY_ATOMIC_COUNTERS"
"GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS"
"GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS"
"GL_MAX_COMPUTE_ATOMIC_COUNTERS"
"GL_MAX_CULL_DISTANCES"
"GL_MAX_COMBINED_CLIP_AND_CULL_DISTANCES"
--]]
max_tex_size = gh_renderer.get_capability_4i("GL_MAX_TEXTURE_SIZE")
Returns the number of OpenGL extensions.
This function has no input parameter(s).
num_extensions = gh_renderer.get_num_opengl_extensions()
Gets the number of virtual screens (macOS only).
This function has no input parameter(s).
num_screens = gh_renderer.get_num_virtual_screens()
Returns the OpenGL error code or 0 if no error.
This function has no input parameter(s).
err_code = gh_renderer.get_opengl_error()
Returns the name of a particular OpenGL extension.
index = 0
gl_extension = gh_renderer.get_opengl_extension(index)
Gets the model of the renderer (the name of the graphics card).
This function has no input parameter(s).
glrenderer = gh_renderer.get_renderer_model()
Gets the vendor of the renderer (the name of the graphics card GPU maker).
This function has no input parameter(s).
glvendor = gh_renderer.get_renderer_vendor()
Gets the GLSL version.
This function has no input parameter(s).
glsl_version = gh_renderer.get_shading_language_version()
Gets the current virtual screen (macOS only).
This function has no input parameter(s).
screen = gh_renderer.get_virtual_screen(ac_buffer, index)
OpenGL / Linux - gets the name of a particular GLX client extension.
name = gh_renderer.glx_get_client_extension(index)
OpenGL / Linux - gets the number of GLX client extensions.
This function has no input parameter(s).
n = gh_renderer.glx_get_client_num_extensions()
OpenGL / Linux - gets a GLX attribute value.
-- Attribute types
GLX_RENDERER_ATTRIBUTE_INFO_GLX_VERSION_MAJOR = 5
GLX_RENDERER_ATTRIBUTE_INFO_GLX_VERSION_MINOR = 6
GLX_RENDERER_ATTRIBUTE_INFO_VENDOR_ID = 7
GLX_RENDERER_ATTRIBUTE_INFO_DEVICE_ID = 8
GLX_RENDERER_ATTRIBUTE_INFO_VERSION_MAJOR = 9
GLX_RENDERER_ATTRIBUTE_INFO_VERSION_MINOR = 10
GLX_RENDERER_ATTRIBUTE_INFO_VERSION_PATCH = 11
GLX_RENDERER_ATTRIBUTE_INFO_ACCELERATED = 12
GLX_RENDERER_ATTRIBUTE_INFO_VIDEO_MEMORY = 13
GLX_RENDERER_ATTRIBUTE_INFO_UMA = 14
attribute = GLX_RENDERER_ATTRIBUTE_INFO_VENDOR_ID
x = gh_renderer.glx_get_renderer_info_int(attribute)
OpenGL / Linux - gets a GLX attribute value.
-- Attribute types
GLX_RENDERER_ATTRIBUTE_INFO_SVR_VENDOR_STR = 1
GLX_RENDERER_ATTRIBUTE_INFO_SVR_VERSION_STR = 2
GLX_RENDERER_ATTRIBUTE_INFO_CLIENT_VENDOR_STR = 3
GLX_RENDERER_ATTRIBUTE_INFO_CLIENT_VERSION_STR = 4
attribute = GLX_RENDERER_ATTRIBUTE_INFO_SVR_VENDOR_STR
str = gh_renderer.glx_get_renderer_info_str(attribute)
OpenGL / Linux - gets the name of a particular GLX server extension.
name = gh_renderer.glx_get_server_extension(index)
OpenGL / Linux - gets the number of GLX server extensions.
This function has no input parameter(s).
n = gh_renderer.glx_get_server_num_extensions()
Returns 1 if OpenGL ES is used. Useful to handle shaders on different platforms.
This function has no input parameter(s).
This function has no return value(s).
is_opengl_es = gh_renderer.is_opengl_es()
Based on OpenGL glMemoryBarrier: defines a barrier ordering memory transactions.
This function has no return value(s).
mask = "GL_SHADER_STORAGE_BARRIER_BIT GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT"
gh_renderer.memory_barrier(mask)
Enables the POINT rendering mode.
This function has no input parameter(s).
This function has no return value(s).
gh_renderer.point()
Applies all states modified with gh_renderer.rasterizer_xxx() functions.
This function has no input parameter(s).
This function has no return value(s).
local BACK_FACE = 0
gh_renderer.rasterizer_set_cull_face(BACK_FACE)
gh_renderer.rasterizer_set_cull_state(0)
local BACK_FRONT_FACE = 2
local LINE = 1
gh_renderer.rasterizer_set_polygon_mode(BACK_FRONT_FACE, LINE)
gh_renderer.rasterizer_apply_states()
Sets the face type to be culled.
This function has no return value(s).
local BACK_FACE = 0
gh_renderer.rasterizer_set_cull_face(BACK_FACE)
gh_renderer.rasterizer_set_cull_state(1)
Enables or disable the face culling state.
This function has no return value(s).
gh_renderer.rasterizer_set_cull_state(1)
Sets the polygon rendering mode.
This function has no return value(s).
local BACK_FRONT_FACE = 2
local LINE = 1
gh_renderer.rasterizer_set_polygon_mode(BACK_FRONT_FACE, LINE)
Sets the blending color used with all CONSTANT_COLOR blending factors.
This function has no return value(s).
gh_renderer.set_blending_color(r, g, b, a)
Sets the blending equation type.
This function has no return value(s).
-- Possible values:
BLEND_EQUATION_ADD = 0
BLEND_EQUATION_SUBTRACT = 1
BLEND_EQUATION_REVERSE_SUBTRACT = 2
BLEND_EQUATION_MIN = 3
BLEND_EQUATION_MAX = 4
eq = BLEND_EQUATION_ADD -- ADD is the default value
gh_renderer.set_blending_equation(eq)
Sets the source and destination blending factors.
This function has no return value(s).
BLEND_FACTOR_ZERO = 0
BLEND_FACTOR_ONE = 1
BLEND_FACTOR_SRC_ALPHA = 2
BLEND_FACTOR_ONE_MINUS_DST_ALPHA = 3
BLEND_FACTOR_ONE_MINUS_DST_COLOR = 4
BLEND_FACTOR_ONE_MINUS_SRC_ALPHA = 5
BLEND_FACTOR_DST_COLOR = 6
BLEND_FACTOR_DST_ALPHA = 7
BLEND_FACTOR_SRC_COLOR = 8
BLEND_FACTOR_ONE_MINUS_SRC_COLOR = 9
BLEND_FACTOR_CONSTANT_COLOR = 10
BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR = 11
BLEND_FACTOR_CONSTANT_ALPHA = 12
BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA = 13
BLEND_FACTOR_SRC_ALPHA_SATURATE = 14
local BLEND_FACTOR_ONE = 1
gh_renderer.set_blending_factors(BLEND_FACTOR_ONE, BLEND_FACTOR_ONE)
gh_renderer.set_blending_state(1)
Enables or disables the color blending.
This function has no return value(s).
gh_renderer.set_blending_state(1)
Sets the depth test function.
This function has no return value(s).
CMP_FUNC_NEVER = 0
CMP_FUNC_LESS = 1
CMP_FUNC_LESS_OR_EQUAL = 2
CMP_FUNC_GREATER = 3
CMP_FUNC_GREATER_OR_EQUAL = 4
CMP_FUNC_EQUAL = 5
CMP_FUNC_NOT_EQUAL = 6
CMP_FUNC_ALWAYS = 7
local CMP_FUNC_LESS = 1
gh_renderer.set_depth_test_func(CMP_FUNC_LESS)
Enables or disable the depth test.
This function has no return value(s).
gh_renderer.set_depth_test_state(1)
Sets line stipple (OpenGL 2.1).
This function has no return value(s).
gh_renderer.set_line_stipple(factor, pattern)
Sets the line width (OpenGL 2.1).
This function has no return value(s).
gh_renderer.set_line_width(2.0)
Sets the scissor rectangle.
This function has no return value(s).
gh_renderer.set_scissor(0, 0, width, height)
Enables or disable the scissor test.
This function has no return value(s).
gh_renderer.set_scissor_state(1)
Enables or disable the texturing state of the fixed pipeline.
This function has no return value(s).
gh_renderer.set_texture2d_state(state)
Sets the viewport.
This function has no return value(s).
gh_renderer.set_viewport(0, 0, width, height)
Sets the viewport and the scissor rectangle in the same call.
This function has no return value(s).
gh_renderer.set_viewport_scissor(0, 0, width, height)
Sets the current virtual screen (macOS only).
This function has no return value(s).
gh_renderer.set_virtual_screen(screen)
Enables or disables the vertical synchronization.
This function has no return value(s).
gh_renderer.set_vsync(0)
OpenGL / NVIDIA GPUs - returns GPU architecture details. Based on OpenGL GL_NV_shader_thread_group extension.
This function has no input parameter(s).
warp_size, warp_per_sm, sm_count = gh_renderer.shader_thread_group_get_properties_nv()
Enables the SOLID rendering mode.
This function has no input parameter(s).
This function has no return value(s).
gh_renderer.solid()
Updates the fixed modelview and projection matrices from a camera and an object. No GPU program is required for the rendering of the object.
This function has no return value(s).
gh_renderer.update_fixed_mvp_matrices(cam_id, obj_id)
Updates the virtual screen. Call this function after a change of virtual screen (macOS only).
This function has no input parameter(s).
This function has no return value(s).
gh_renderer.update_virtual_screen()
Enables the WIREFRAME (or LINE) rendering mode.
This function has no input parameter(s).
This function has no return value(s).
gh_renderer.wireframe()