GR3 Reference

The gr3 header

Defines

GR3API
GR3_MC_DTYPE

Typedefs

typedef struct gr3_volume_2pass_priv gr3_volume_2pass_priv_t

Enums

enum gr3_init_property_t

These constants can be used to specify various properties when calling gr3_init().

Values:

enumerator GR3_IA_END_OF_LIST

This constant is used as a delimiter for the attribute list.

enumerator GR3_IA_FRAMEBUFFER_WIDTH

The next element of the attribute list will be used as the width of the framebuffer used for rendering. Default: 512

enumerator GR3_IA_FRAMEBUFFER_HEIGHT

The next element of the attribute list will be used as the height of the framebuffer used for rendering. Default: 512

enumerator GR3_IA_NUM_THREADS

The next element of the attribute list will be used as the number of Threads used by the Software-Renderer Default: 0 (its then set to the number of cores)

enum gr3_error_t

These contants are error codes returned by gr3 functions.

Values:

enumerator GR3_ERROR_NONE

The function was successful

enumerator GR3_ERROR_INVALID_VALUE

The function failed because of an invalid value

enumerator GR3_ERROR_INVALID_ATTRIBUTE

The function failed because of an invalid attribute

enumerator GR3_ERROR_INIT_FAILED

Initialization failed

enumerator GR3_ERROR_OPENGL_ERR

An OpenGL error occured

enumerator GR3_ERROR_OUT_OF_MEM

gr3 was unable to allocate required memory. If this error \ occurs, gr3 state is undefined.

enumerator GR3_ERROR_NOT_INITIALIZED

A function was called before initializing gr3.

enumerator GR3_ERROR_CAMERA_NOT_INITIALIZED

gr3_getpixmap() was called before initializing the camera

enumerator GR3_ERROR_UNKNOWN_FILE_EXTENSION
enumerator GR3_ERROR_CANNOT_OPEN_FILE
enumerator GR3_ERROR_EXPORT
enum gr3_quality_t

Values:

enumerator GR3_QUALITY_OPENGL_NO_SSAA
enumerator GR3_QUALITY_POVRAY_NO_SSAA
enumerator GR3_QUALITY_OPENGL_2X_SSAA
enumerator GR3_QUALITY_POVRAY_2X_SSAA
enumerator GR3_QUALITY_OPENGL_4X_SSAA
enumerator GR3_QUALITY_POVRAY_4X_SSAA
enumerator GR3_QUALITY_OPENGL_8X_SSAA
enumerator GR3_QUALITY_POVRAY_8X_SSAA
enumerator GR3_QUALITY_OPENGL_16X_SSAA
enumerator GR3_QUALITY_POVRAY_16X_SSAA
enum gr3_drawable_t

Values:

enumerator GR3_DRAWABLE_OPENGL
enumerator GR3_DRAWABLE_GKS
enum gr3_projection_t

Values:

enumerator GR3_PROJECTION_PERSPECTIVE
enumerator GR3_PROJECTION_PARALLEL
enumerator GR3_PROJECTION_ORTHOGRAPHIC
enum gr3_surface_t

Values:

enumerator GR3_SURFACE_DEFAULT

default behavior

enumerator GR3_SURFACE_NORMALS

interpolate the vertex normals from the gradient

enumerator GR3_SURFACE_FLAT

set all z-coordinates to zero

enumerator GR3_SURFACE_GRTRANSFORM

use gr_inqwindow, gr_inqspace and gr_inqscale to transform the data to NDC coordinates

enumerator GR3_SURFACE_GRCOLOR

color the surface according to the current gr colormap

enumerator GR3_SURFACE_GRZSHADED

like GR3_SURFACE_GRCOLOR, but use the z-value directly as color index

enum gr3_transparency_t

Values:

enumerator GR3_TRANSPARENCY_OPAQUE
enumerator GR3_TRANSPARENCY_TRANSMIT
enumerator GR3_TRANSPARENCY_FILTER

Functions

int gr3_init(int *attrib_list)

This method initializes the gr3 context.

See also

gr3_terminate()

See also

context_struct_

See also

int

Parameters:

attrib_list[in] This GR3_IA_END_OF_LIST-terminated list can specify details about context creation. The attributes which use unsigned integer values are followed by these values.

Returns:

void gr3_free(void *pointer)
void gr3_terminate(void)

This function terminates the gr3 context. After calling this function, gr3 is in the same state as when it was first loaded, except for context-independent variables, i.e. the logging callback.

See also

gr3_init()

See also

context_struct_

Note

It is safe to call this function even if the context is not initialized.

int gr3_geterror(int clear, int *line, const char **file)

This function returns information on the most recent GR3 error.

Parameters:
  • clear[in] 1 if the error information should be cleared

  • line[out] the code line the error was returned from

  • file[out] the code file the error was returned from

Returns:

the last non-zero error code

const char *gr3_getrenderpathstring(void)

This function allows the user to find out how his commands are rendered.

Returns:

If gr3 is initialized, a string in the format: “gr3 - ” + window toolkit + ” - ” + framebuffer extension + ” - “

  • OpenGL version + ” - ” + OpenGL renderer string For example “gr3 - GLX - GL_ARB_framebuffer_object - 2.1 Mesa

    7.10.2 - Software Rasterizer” might be returned on a Linux system (using GLX) with an available GL_ARB_framebuffer_object implementation. If gr3 is not initialized “Not initialized” is returned.

const char *gr3_geterrorstring(int error)

This function returns a string representation of a given error code.

Parameters:

error[in] The error code whose represenation will be returned.

void gr3_setlogcallback(void (*gr3_log_func)(const char *log_message))

During software development it will often be helpful to get debug output from gr3. This information is not printed, but reported directly to the user by calling a logging callback. This function allows to set this callback or disable it again by calling it with NULL.

Parameters:

gr3_log_func[in] The logging callback, a function which gets a const char pointer as its only argument and returns nothing.

int gr3_clear(void)

This function clears the draw list.

Returns:

void gr3_usecurrentframebuffer(void)
void gr3_useframebuffer(unsigned int framebuffer)
int gr3_setquality(int quality)
int gr3_getimage(int width, int height, int use_alpha, char *pixels)
int gr3_export(const char *filename, int width, int height)
int gr3_drawimage(float xmin, float xmax, float ymin, float ymax, int width, int height, int drawable_type)
int gr3_createmesh_nocopy(int *mesh, int n, float *vertices, float *normals, float *colors)

This function creates a mesh from vertex position, normal and color data. The arrays are used directly without copying. The array parameters MUST be pointers to the beginning of a memory region previously allocated by malloc or calloc. Changing the data in these arrays or freeing them leads to undefined behavior. After calling this routine the arrays are owned by GR3 and will be freed by it. If unsure, use gr3_createmesh.

Parameters:
  • mesh[out] a pointer to a int

  • vertices[in] the vertex positions

  • normals[in] the vertex normals

  • colors[in] the vertex colors, they should be white (1,1,1) if you want to change the color for each drawn mesh

  • n[in] the number of vertices in the mesh

Returns:

int gr3_createmesh(int *mesh, int n, const float *vertices, const float *normals, const float *colors)

This function creates a int from vertex position, normal and color data.

Parameters:
  • mesh[out] a pointer to a int

  • vertices[in] the vertex positions

  • normals[in] the vertex normals

  • colors[in] the vertex colors, they should be white (1,1,1) if you want to change the color for each drawn mesh

  • n[in] the number of vertices in the mesh

Returns:

int gr3_createindexedmesh_nocopy(int *mesh, int number_of_vertices, float *vertices, float *normals, float *colors, int number_of_indices, int *indices)

This function creates an indexed mesh from vertex information (position, normal and color) and triangle information (indices). The arrays are used directly without copying. The array parameters MUST be pointers to the beginning of a memory region previously allocated by malloc or calloc. Changing the data in these arrays or freeing them leads to undefined behavior. After calling this routine the arrays are owned by GR3 and will be freed by it. If unsure, use gr3_createindexedmesh.

Parameters:
  • mesh[out] a pointer to an int

  • number_of_vertices[in] the number of vertices in the mesh

  • vertices[in] the vertex positions

  • normals[in] the vertex normals

  • colors[in] the vertex colors, they should be white (1,1,1) if you want to change the color for each drawn mesh

  • number_of_indices[in] the number of indices in the mesh (three times the number of triangles)

  • indices[in] the index array (vertex indices for each triangle)

Returns:

int gr3_createindexedmesh(int *mesh, int number_of_vertices, const float *vertices, const float *normals, const float *colors, int number_of_indices, const int *indices)

This function creates an indexed mesh from vertex information (position, normal and color) and triangle information (indices).

Parameters:
  • mesh[out] a pointer to an int

  • number_of_vertices[in] the number of vertices in the mesh

  • vertices[in] the vertex positions

  • normals[in] the vertex normals

  • colors[in] the vertex colors, they should be white (1,1,1) if you want to change the color for each drawn mesh

  • number_of_indices[in] the number of indices in the mesh (three times the number of triangles)

  • indices[in] the index array (vertex indices for each triangle)

Returns:

void gr3_drawmesh(int mesh, int n, const float *positions, const float *directions, const float *ups, const float *colors, const float *scales)

This function adds a mesh to the draw list, so it will be drawn when the user calls gr3_getpixmap_(). The given data stays owned by the user, a copy will be saved in the draw list and the mesh reference counter will be increased.

Note

This function does not return an error code, because of its asynchronous nature. If gr3_getpixmap_() returns a GR3_ERROR_OPENGL_ERR, this might be caused by this function saving unuseable data into the draw list.

Parameters:
  • mesh[in] The mesh to be drawn

  • positions[in] The positions where the meshes should be drawn

  • directions[in] The forward directions the meshes should be facing at

  • ups[in] The up directions

  • colors[in] The colors the meshes should be drawn in, it will be multiplied with each vertex color

  • scales[in] The scaling factors

  • n[in] The number of meshes to be drawn

void gr3_deletemesh(int mesh)

This function marks a mesh for deletion and removes the user’s reference from the mesh’s referenc counter, so a user must not use the mesh after calling this function. If the mesh is still in use for draw calls, the mesh will not be truly deleted until gr3_clear() is called.

Parameters:

mesh[in] The mesh that should be marked for deletion

void gr3_cameralookat(float camera_x, float camera_y, float camera_z, float center_x, float center_y, float center_z, float up_x, float up_y, float up_z)

This function sets the view matrix by getting the position of the camera, the position of the center of focus and the direction which should point up. This function takes effect when the next image is created. Therefore if you want to take pictures of the same data from different perspectives, you can call and gr3_cameralookat(), gr3_getpixmap_(), gr3_cameralookat(), gr3_getpixmap_(), … without calling gr3_clear() and gr3_drawmesh() again.

Note

Source: http://www.opengl.org/sdk/docs/man/xhtml/gluLookAt.xml (as of 10/24/2011, licensed under SGI Free Software Licence B)

Parameters:
  • camera_x[in] The x-coordinate of the camera

  • camera_y[in] The y-coordinate of the camera

  • camera_z[in] The z-coordinate of the camera

  • center_x[in] The x-coordinate of the center of focus

  • center_y[in] The y-coordinate of the center of focus

  • center_z[in] The z-coordinate of the center of focus

  • up_x[in] The x-component of the up direction

  • up_y[in] The y-component of the up direction

  • up_z[in] The z-component of the up direction

int gr3_setcameraprojectionparameters(float vertical_field_of_view, float zNear, float zFar)

This function sets the projection parameters. This function takes effect when the next image is created.

Note

The ratio between zFar and zNear influences the precision of the depth buffer, the greater \( \frac{zFar}{zNear} \), the more likely are errors. So you should try to keep both values as close to each other as possible while making sure everything you want to be visible, is visible.

Parameters:
  • vertical_field_of_view[in] This parameter is the vertical field of view in degrees. It must be greater than 0 and less than 180.

  • zNear[in] The distance to the near clipping plane.

  • zFar[in] The distance to the far clipping plane.

Returns:

int gr3_getcameraprojectionparameters(float *vfov, float *znear, float *zfar)

Get the projection parameters.

Parameters:
  • vfov[out] Vertical field of view in degrees

  • znear[out] The distance to the near clipping plane.

  • zfar[out] The distance to the far clipping plane.

Returns:

void gr3_setlightdirection(float x, float y, float z)

This function sets the direction of light. If it is called with (0, 0, 0), the light is always pointing into the same direction as the camera.

Parameters:
  • x[in] The x-component of the light’s direction

  • y[in] The y-component of the light’s direction

  • z[in] The z-component of the light’s direction

void gr3_setbackgroundcolor(float red, float green, float blue, float alpha)

This function sets the background color.

int gr3_createheightmapmesh(const float *heightmap, int num_columns, int num_rows)
void gr3_drawheightmap(const float *heightmap, int num_columns, int num_rows, const float *positions, const float *scales)
void gr3_drawconemesh(int n, const float *positions, const float *directions, const float *colors, const float *radii, const float *lengths)
void gr3_drawcylindermesh(int n, const float *positions, const float *directions, const float *colors, const float *radii, const float *lengths)
void gr3_drawspheremesh(int n, const float *positions, const float *colors, const float *radii)
void gr3_drawcubemesh(int n, const float *positions, const float *directions, const float *ups, const float *colors, const float *scales)
void gr3_setobjectid(int id)
int gr3_selectid(int x, int y, int width, int height, int *selection_id)
void gr3_getviewmatrix(float *m)
Parameters:

m[out] the 4x4 column major view matrix

void gr3_setviewmatrix(const float *m)
Parameters:

m[in] the 4x4 column major view matrix

int gr3_getprojectiontype(void)
Returns:

the current projection type: GR3_PROJECTION_PERSPECTIVE, GR3_PROJECTION_PARALLEL or GR3_PROJECTION_ORTHOGRAPHIC

void gr3_setprojectiontype(int type)
Parameters:

type[in] the new projection type: GR3_PROJECTION_PERSPECTIVE, GR3_PROJECTION_PARALLEL or GR3_PROJECTION_ORTHOGRAPHIC

unsigned int gr3_triangulate(const GR3_MC_DTYPE *data, GR3_MC_DTYPE isolevel, unsigned int dim_x, unsigned int dim_y, unsigned int dim_z, unsigned int stride_x, unsigned int stride_y, unsigned int stride_z, double step_x, double step_y, double step_z, double offset_x, double offset_y, double offset_z, gr3_triangle_t **triangles_p)

Create an isosurface (as mesh) from voxel data with the marching cubes algorithm. This function calls gr3_triangulateindexed and copies the values.

Parameters:
  • data[in] the volume (voxel) data

  • isolevel[in] value where the isosurface will be extracted

  • dim_x[in] number of elements in x-direction

  • dim_y[in] number of elements in y-direction

  • dim_z[in] number of elements in z-direction

  • stride_x[in] number of elements to step when traversing the data in x-direction

  • stride_y[in] number of elements to step when traversing the data in y-direction

  • stride_z[in] number of elements to step when traversing the data in z-direction

  • step_x[in] distance between the voxels in x-direction

  • step_y[in] distance between the voxels in y-direction

  • step_z[in] distance between the voxels in z-direction

  • offset_x[in] coordinate origin

  • offset_y[in] coordinate origin

  • offset_z[in] coordinate origin

  • triangles_p[out] array of triangle data

Returns:

the number of triangles created

void gr3_triangulateindexed(const GR3_MC_DTYPE *data, GR3_MC_DTYPE isolevel, unsigned int dim_x, unsigned int dim_y, unsigned int dim_z, unsigned int stride_x, unsigned int stride_y, unsigned int stride_z, double step_x, double step_y, double step_z, double offset_x, double offset_y, double offset_z, unsigned int *num_vertices, gr3_coord_t **vertices, gr3_coord_t **normals, unsigned int *num_indices, unsigned int **indices)

Create an isosurface (as indexed mesh) from voxel data with the marching cubes algorithm. This function manages the parallelization: Divide the data into blocks along the x-axis. Allocate memory, call layerblock and merge the individual meshes into a single one.

Parameters:
  • data[in] the volume (voxel) data

  • isolevel[in] value where the isosurface will be extracted

  • dim_x[in] number of elements in x-direction

  • dim_y[in] number of elements in y-direction

  • dim_z[in] number of elements in z-direction

  • stride_x[in] number of elements to step when traversing the data in x-direction

  • stride_y[in] number of elements to step when traversing the data in y-direction

  • stride_z[in] number of elements to step when traversing the data in z-direction

  • step_x[in] distance between the voxels in x-direction

  • step_y[in] distance between the voxels in y-direction

  • step_z[in] distance between the voxels in z-direction

  • offset_x[in] coordinate origin

  • offset_y[in] coordinate origin

  • offset_z[in] coordinate origin

  • num_vertices[out] number of vertices created

  • vertices[out] array of vertex coordinates

  • normals[out] array of vertex normal vectors

  • num_indices[out] number of indices created (3 times the number of triangles)

  • indices[out] array of vertex indices that make the triangles

int gr3_createisosurfacemesh(int *mesh, GR3_MC_DTYPE *data, GR3_MC_DTYPE isolevel, unsigned int dim_x, unsigned int dim_y, unsigned int dim_z, unsigned int stride_x, unsigned int stride_y, unsigned int stride_z, double step_x, double step_y, double step_z, double offset_x, double offset_y, double offset_z)
int gr3_createsurfacemesh(int *mesh, int nx, int ny, float *px, float *py, float *pz, int option)

Create a mesh of a surface plot similar to gr_surface. Uses the current colormap. To apply changes of the colormap a new mesh has to be created.

Parameters:
  • mesh[out] the mesh handle

  • nx[in] number of points in x-direction

  • ny[in] number of points in y-direction

  • px[in] an array containing the x-coordinates

  • py[in] an array containing the y-coordinates

  • pz[in] an array of length nx * ny containing the z-coordinates

  • option[in] option for the surface mesh; the GR3_SURFACE constants can be combined with bitwise or.

int gr3_createsurface3dmesh(int *mesh, int ncols, int nrows, float *px, float *py, float *pz)

Create a mesh of a 3d surface. Uses the current colormap. To apply changes of the colormap a new mesh has to be created.

Parameters:
  • mesh[out] the mesh handle

  • ncols[in] number of columns in the coordinate arrays

  • nrows[in] number of rows in the coordinate arrays

  • px[in] an array containing the x-coordinates

  • py[in] an array containing the y-coordinates

  • pz[in] an array containing the z-coordinates

void gr3_drawmesh_grlike(int mesh, int n, const float *positions, const float *directions, const float *ups, const float *colors, const float *scales)

Draw a mesh with the projection of gr. It uses the current projection parameters (rotation, tilt) of gr. This function alters the projection type, the projection parameters, the viewmatrix and the light direction. If necessary, the user has to save them before the call to this function and restore them after the call to gr3_drawimage.

Parameters:
  • mesh[in] the mesh to be drawn

  • n[in] the number of meshes to be drawn

  • positions[in] the positions where the meshes should be drawn

  • directions[in] the forward directions the meshes should be facing at

  • ups[in] the up directions

  • colors[in] the colors the meshes should be drawn in, it will be multiplied with each vertex color

  • scales[in] the scaling factors

void gr3_drawsurface(int mesh)

Convenience function for drawing a surfacemesh

Parameters:

mesh[in] the mesh to be drawn

void gr3_surface(int nx, int ny, float *px, float *py, float *pz, int option)

Create a surface plot with gr3 and draw it with gks as cellarray

Parameters:
  • nx[in] number of points in x-direction

  • ny[in] number of points in y-direction

  • px[in] an array containing the x-coordinates

  • py[in] an array containing the y-coordinates

  • pz[in] an array of length nx * ny containing the z-coordinates

  • option[in] see the option parameter of gr_surface additionally supports option 3D_MESH

void gr3_isosurface(int nx, int ny, int nz, const float *data, float isovalue, const float *color, const int *strides)

Create an isosurface plot and draw it with GKS

Parameters:
  • nx[in] number of voxels in x-direction

  • ny[in] number of voxels in y-direction

  • nz[in] number of voxels in z-direction

  • data[in] an array containing the voxel data

  • isosurface[in] an array containing the y-coordinates

  • color[in] an array containting the RGB values, or NULL to use the default color

  • strides[in] an array containting the 3 axis strides, or NULL to use strides for x-y-z axis order

int gr3_drawtubemesh(int n, float *points, float *colors, float *radii, int num_steps, int num_segments)
int gr3_createtubemesh(int *mesh, int n, const float *points, const float *colors, const float *radii, int num_steps, int num_segments)
void gr3_drawspins(int n, const float *positions, const float *directions, const float *colors, float cone_radius, float cylinder_radius, float cone_height, float cylinder_height)
void gr3_drawmolecule(int n, const float *positions, const float *colors, const float *radii, float bond_radius, const float bond_color[3], float bond_delta)
void gr3_createxslicemesh(int *mesh, const GR3_MC_DTYPE *data, unsigned int ix, unsigned int dim_x, unsigned int dim_y, unsigned int dim_z, unsigned int stride_x, unsigned int stride_y, unsigned int stride_z, double step_x, double step_y, double step_z, double offset_x, double offset_y, double offset_z)
void gr3_createyslicemesh(int *mesh, const GR3_MC_DTYPE *data, unsigned int iy, unsigned int dim_x, unsigned int dim_y, unsigned int dim_z, unsigned int stride_x, unsigned int stride_y, unsigned int stride_z, double step_x, double step_y, double step_z, double offset_x, double offset_y, double offset_z)
void gr3_createzslicemesh(int *mesh, const GR3_MC_DTYPE *data, unsigned int iz, unsigned int dim_x, unsigned int dim_y, unsigned int dim_z, unsigned int stride_x, unsigned int stride_y, unsigned int stride_z, double step_x, double step_y, double step_z, double offset_x, double offset_y, double offset_z)
void gr3_drawxslicemesh(const GR3_MC_DTYPE *data, unsigned int ix, unsigned int dim_x, unsigned int dim_y, unsigned int dim_z, unsigned int stride_x, unsigned int stride_y, unsigned int stride_z, double step_x, double step_y, double step_z, double offset_x, double offset_y, double offset_z)
void gr3_drawyslicemesh(const GR3_MC_DTYPE *data, unsigned int iy, unsigned int dim_x, unsigned int dim_y, unsigned int dim_z, unsigned int stride_x, unsigned int stride_y, unsigned int stride_z, double step_x, double step_y, double step_z, double offset_x, double offset_y, double offset_z)
void gr3_drawzslicemesh(const GR3_MC_DTYPE *data, unsigned int iz, unsigned int dim_x, unsigned int dim_y, unsigned int dim_z, unsigned int stride_x, unsigned int stride_y, unsigned int stride_z, double step_x, double step_y, double step_z, double offset_x, double offset_y, double offset_z)
void gr3_drawtrianglesurface(int n, const float *triangles)

Draw the given triangles using the current GR colormap

Parameters:
  • n[in] number of triangles

  • positions[in] pointer to an array of 3*3*n float values

void gr_volume(int nx, int ny, int nz, double *data, int algorithm, double *dmin_ptr, double *dmax_ptr)

Draw volume data using the given algorithm and apply the current GR colormap.

Available algorithms are:

GR_VOLUME_EMISSION

0

emission model

GR_VOLUME_ABSORPTION

1

absorption model

GR_VOLUME_MIP

2

maximum intensity projection

Parameters:
  • nx[in] number of points in x-direction

  • ny[in] number of points in y-direction

  • nz[in] number of points in z-direction

  • data[in] an array of shape nx * ny * nz containing the intensities for each point

  • algorithm[in] the algorithm to reduce the volume data

  • dmin_ptr[inout] The variable this parameter points at will be used as minimum data value when applying the colormap. If it is negative, the variable will be set to the actual occuring minimum and that value will be used instead. If dmin_ptr is NULL, it will be ignored.

  • dmax_ptr[inout] The variable this parameter points at will be used as maximum data value when applying the colormap. If it is negative, the variable will be set to the actual occuring maximum and that value will be used instead. If dmax_ptr is NULL, it will be ignored.

const gr3_volume_2pass_t *gr_volume_2pass(int nx, int ny, int nz, double *data, int algorithm, double *dmin_ptr, double *dmax_ptr, const gr3_volume_2pass_t *context)
void gr3_setorthographicprojection(float left, float right, float bottom, float top, float znear, float zfar)

Set parameters for orthographic transformation

Switches projection type to orthographic

Parameters:
  • left – xmin of the volume in worldcoordinates

  • right – xmax of volume in worldcoordinates

  • bottom – ymin of volume in worldcoordinates

  • top – ymax of volume in worldcoordinates

  • near_plane – distance to near clipping plane

  • far_plane – distance to far clipping plane

void gr3_setsurfaceoption(int option)
int gr3_getsurfaceoption(void)
int gr3_getlightsources(int max_num_lights, float *positions, float *colors)

This method writes up to max_num_lights light sources in directions and colors.

Use gr3_getlightsources(0, NULL, NULL) to query the current number of light sources without getting the light sources themselves.

Parameters:
  • max_num_lights[in] the maximum number of light sources

  • directions[out] the directions of the light, or NULL

  • colors[out] the colors of the light, or NULL

Returns:

the number of light sources written into directions and colors, or the current number of light sources

int gr3_setlightsources(int num_lights, float *positions, float *colors)

This method sets the light sources.

Parameters:
  • num_lights[in] the number of light sources

  • directions[in] the directions of the light

  • colors[in] the colors of the light

Returns:

void gr3_setlightparameters(float ambient, float diffuse, float specular, float specular_power)
void gr3_getlightparameters(float *ambient, float *diffuse, float *specular, float *specular_power)
void gr3_setdefaultlightparameters(void)
int gr3_getalphamode(int *mode)
void gr3_setalphamode(int mode)
void gr3_setclipping(float xmin, float xmax, float ymin, float ymax, float zmin, float zmax)
void gr3_getclipping(float *xmin, float *xmax, float *ymin, float *ymax, float *zmin, float *zmax)
struct gr3_coord_t

Public Members

float x
float y
float z
struct gr3_triangle_t

Public Members

gr3_coord_t vertex[3]
gr3_coord_t normal[3]
struct gr3_volume_2pass_t

Public Members

double dmin
double dmax
gr3_volume_2pass_priv_t *priv