amino  1.0-beta2
Lightweight Robot Utility Library
scene_gl.h File Reference

OpenGL Support. More...

#include <SDL_opengl.h>

Go to the source code of this file.

Functions

AA_API void aa_rx_sg_gl_init (struct aa_rx_sg *sg)
 Initialize OpenGL objects in scene graph. More...
 
AA_API void aa_rx_sg_render (const struct aa_rx_sg *scenegraph, const struct aa_gl_globals *globals, size_t n_TF, const double *TF_abs, size_t ld_TF)
 Render the scene graph to the current GL context. More...
 
AA_API void aa_gl_qutr2glmat (const double E[AA_RESTRICT 7], GLfloat M[AA_RESTRICT 16])
 Convert a quaternion-translation to an OpenGL matrix.
 
AA_API void aa_gl_tfmat2glmat (const double T[AA_RESTRICT 12], GLfloat M[AA_RESTRICT 16])
 Convert a condensed transformation matrix to an OpenGL matrix.
 
AA_API void aa_gl_mat_perspective (double fovy, double aspect, double znear, double zfar, GLfloat M[16])
 Create a OpenGL matrix for a perspective transform.
 
AA_API GLuint aa_gl_create_shader (GLenum shader_type, const char *source)
 Compile a shader from a text string.
 
AA_API GLuint aa_gl_create_program (GLuint vert_shader, GLuint frag_shader)
 Create a GLSL program and attach shaders.
 
AA_API void aa_gl_init ()
 Initialize GL engine.
 
AA_API struct aa_gl_globals * aa_gl_globals_create ()
 Container for globals rendering info (Forward declaration)
 
AA_API void aa_gl_globals_destroy (struct aa_gl_globals *globals)
 Destroy a aa_gl_globals struct.
 
AA_API void aa_gl_globals_set_camera (struct aa_gl_globals *globals, const double world_E_camera[7])
 Set the camera transform.
 
AA_API void aa_gl_globals_set_camera_home (struct aa_gl_globals *globals, const double world_E_camera_home[7])
 Set the camera "home" transform.
 
AA_API void aa_gl_globals_home_camera (struct aa_gl_globals *globals)
 Set the camera transform to its "home" value.
 
AA_API void aa_gl_globals_set_light_position (struct aa_gl_globals *globals, const double world_v_light[3])
 Set the position of the light.
 
AA_API void aa_gl_globals_set_aspect (struct aa_gl_globals *globals, double aspect)
 Set the camera aspect ratio.
 
AA_API void aa_gl_globals_set_perspective (struct aa_gl_globals *globals, double fovy, double aspect, double znear, double zfar)
 Set the camera perspective matrix.
 
AA_API void aa_gl_globals_set_light_color (struct aa_gl_globals *globals, const double color[3])
 Set the color of the light.
 
AA_API void aa_gl_globals_set_light_power (struct aa_gl_globals *globals, double power)
 Set the power (intensity) of the light.
 
AA_API void aa_gl_globals_set_ambient (struct aa_gl_globals *globals, const double ambient[3])
 Set the light ambient color.
 
AA_API void aa_gl_globals_set_show_visual (struct aa_gl_globals *globals, int show_visual)
 Set flag to enable render of visual geometry.
 
AA_API void aa_gl_globals_set_show_collision (struct aa_gl_globals *globals, int show_collision)
 Set flag to enable render of collision geometry.
 
AA_API void aa_gl_globals_unmask_all (struct aa_gl_globals *globals)
 Set the display mask value of all frames to false.
 
AA_API int aa_gl_globals_is_masked (const struct aa_gl_globals *globals, size_t i)
 Return the display mask value of the i'th frame.
 
AA_API void aa_gl_globals_mask (struct aa_gl_globals *globals, size_t i, int value)
 Set the display mask value of the i'th frame to ‘value’. More...
 
AA_API void aa_geom_gl_buffers_init (struct aa_rx_geom *geom)
 Initialize OpenGL buffers for geometry object.
 
AA_API void aa_gl_buffers_destroy (struct aa_gl_buffers *buffers)
 Destroy OpenGL buffers. More...
 
AA_API void aa_gl_buffers_schedule_destroy (struct aa_gl_buffers *buffers)
 Schedule destruction of OpenGL buffers. More...
 
AA_API void aa_gl_buffers_cleanup (void)
 Destroy previously schedule OpenGL buffers. More...
 
AA_API const char * aa_gl_error_string (GLenum error)
 Return a string describing the error.
 

Detailed Description

OpenGL Support.

Definition in file scene_gl.h.

Function Documentation

◆ aa_gl_buffers_cleanup()

AA_API void aa_gl_buffers_cleanup ( void  )

Destroy previously schedule OpenGL buffers.

This function should only be called from the thread that owns the GL context for buffers, i.e., the rendering thread..

◆ aa_gl_buffers_destroy()

AA_API void aa_gl_buffers_destroy ( struct aa_gl_buffers *  buffers)

Destroy OpenGL buffers.

This function should only be called from the thread that owns the GL context for buffers.

◆ aa_gl_buffers_schedule_destroy()

AA_API void aa_gl_buffers_schedule_destroy ( struct aa_gl_buffers *  buffers)

Schedule destruction of OpenGL buffers.

This function can be called from any thread.

◆ aa_gl_globals_mask()

AA_API void aa_gl_globals_mask ( struct aa_gl_globals *  globals,
size_t  i,
int  value 
)

Set the display mask value of the i'th frame to ‘value’.

Frames with a true display mask are hidden.

◆ aa_rx_sg_gl_init()

AA_API void aa_rx_sg_gl_init ( struct aa_rx_sg sg)

Initialize OpenGL objects in scene graph.

This function is not threadsafe. Do not attempt to access the same GL context from multiple threads.

See also
aa_rx_win_sg_gl_init()

◆ aa_rx_sg_render()

AA_API void aa_rx_sg_render ( const struct aa_rx_sg scenegraph,
const struct aa_gl_globals *  globals,
size_t  n_TF,
const double *  TF_abs,
size_t  ld_TF 
)

Render the scene graph to the current GL context.

This function is not threadsafe. Do not attempt to access the same GL context from multiple threads.

Parameters
scengreaphthe scene graph to render
globalsthe opengl global values
n_TFsize of the TF array
TF_absabsolute transforms of frames in the scene graph (quaternion-translation format)
ld_TFleading dimension of TF_abs (typically 7)
Precondition
aa_rx_sg_init() was called after all frames added and aa_rx_sg_gl_init() was called after all geometry attached.