Graphite  Version 3
An experimental 3D geometry processing program
GLUP_context.h File Reference

Internal implementation of GLUP context. More...

Go to the source code of this file.

Classes

class  GLUP::MatrixStack
 A Matrix stack. More...
 
struct  GLUP::MatrixStack::Matrix
 
class  GLUP::ImmediateBuffer
 A buffer used by GLUP in immediate mode. More...
 
class  GLUP::ImmediateState
 Stores all the buffers used to implement the immediate-mode interface. More...
 
class  GLUP::StateVariableBase
 Base class for representing GLUP state variables. More...
 
class  GLUP::StateVariable< T >
 A GLUP state variable of a given type. More...
 
class  GLUP::FloatsArrayStateVariable
 A GLUP state variable that contains an array of floating points. This concerns both vectors and matrices. More...
 
class  GLUP::VectorStateVariable
 A GLUP state variable that contains a vector. More...
 
struct  GLUP::UniformState
 The set of state variables that represent GLUP uniform state. More...
 
struct  GLUP::PrimitiveInfo
 Stores the programs and vertex array object used to display a primitive of a given type. More...
 
class  GLUP::Context
 GLUP context stores a Uniform Buffer Object with state variables similar to OpenGL's fixed functionality pipeline, and a set of Vertex Buffer Objects to emulate OpenGL's immediate mode. More...
 

Enumerations

enum  GLUP::GLUPattribute {
  GLUP_VERTEX_ATTRIBUTE = 0 , GLUP_COLOR_ATTRIBUTE = 1 , GLUP_TEX_COORD_ATTRIBUTE = 2 , GLUP_NORMAL_ATTRIBUTE = 3 ,
  GLUP_VERTEX_ID_ATTRIBUTE = 4
}
 Index of an ImmediateBuffer in the ImmediateState. More...
 

Functions

GLboolean GLUP::invert_matrix (GLfloat inv[16], const GLfloat m[16])
 Computes the inverse of a 4x4 matrix. More...
 
GLboolean GLUP::invert_matrix (GLdouble inv[16], const GLdouble m[16])
 Computes the inverse of a 4x4 matrix. More...
 
void GLUP::mult_matrices (GLfloat out[16], const GLfloat m1[16], const GLfloat m2[16])
 Computes the product of two 4x4 matrices. More...
 
void GLUP::mult_matrices (GLdouble out[16], const GLdouble m1[16], const GLdouble m2[16])
 Computes the product of two 4x4 matrices. More...
 
void GLUP::mult_matrix_vector (GLfloat out[4], const GLfloat m[16], const GLfloat v[4])
 Computes the product of a 4x4 matrix and a vector. More...
 
void GLUP::mult_transpose_matrix_vector (GLfloat out[4], const GLfloat m[16], const GLfloat v[4])
 Computes the product of the transpose of a 4x4 matrix and a vector. More...
 
void GLUP::mult_transpose_matrix_vector (GLdouble out[4], const GLdouble m[16], const GLdouble v[4])
 Computes the product of the transpose of a 4x4 matrix and a vector. More...
 
void GLUP::mult_matrix_vector (GLdouble out[4], const GLdouble m[16], const GLdouble v[4])
 Computes the product of a 4x4 matrix and a vector. More...
 
void GLUP::transpose_matrix (GLfloat m[16])
 Transposes a matrix in-place. More...
 
void GLUP::transpose_matrix (GLdouble m[16])
 Transposes a matrix in-place. More...
 
void GLUP::show_matrix (const GLfloat m[16])
 For debugging, outputs a matrix to the standard error. More...
 
void GLUP::show_matrix (const GLdouble m[16])
 For debugging, outputs a matrix to the standard error. More...
 
void GLUP::show_vector (const GLfloat v[4])
 For debugging, outputs a vector to the standard error. More...
 
void GLUP::show_vector (const GLdouble v[4])
 For debugging, outputs a vector to the standard error. More...
 
void GLUP::load_identity_matrix (GLfloat out[16])
 Resets a matrix to the identity matrix. More...
 
void GLUP::load_identity_matrix (GLdouble out[16])
 Resets a matrix to the identity matrix. More...
 
void GLUP::copy_vector (GLfloat *to, const GLfloat *from, index_t dim)
 Copies a vector of floats. More...
 
void GLUP::copy_vector (GLdouble *to, const GLdouble *from, index_t dim)
 Copies a vector of doubles. More...
 
void GLUP::copy_vector (GLfloat *to, const GLdouble *from, index_t dim)
 Copies a vector of doubles to a vector of floats. More...
 
void GLUP::copy_vector (GLdouble *to, const GLfloat *from, index_t dim)
 Copies a vector of floats to a vector of doubles. More...
 
void GLUP::normalize_vector (GLfloat v[3])
 Normalizes a vector. More...
 

Detailed Description

Internal implementation of GLUP context.

Definition in file GLUP_context.h.

Enumeration Type Documentation

◆ GLUPattribute

Index of an ImmediateBuffer in the ImmediateState.

GLUP_VERTEX_ID_ATTRIBUTE is used internally

Definition at line 347 of file GLUP_context.h.

Function Documentation

◆ copy_vector() [1/4]

void GLUP::copy_vector ( GLdouble *  to,
const GLdouble *  from,
index_t  dim 
)
inline

Copies a vector of doubles.

Parameters
[out]toa pointer to the destination vector
[in]froma const pointer to the source vector
[in]dimthe number of components to copy

Definition at line 226 of file GLUP_context.h.

◆ copy_vector() [2/4]

void GLUP::copy_vector ( GLdouble *  to,
const GLfloat *  from,
index_t  dim 
)
inline

Copies a vector of floats to a vector of doubles.

Parameters
[out]toa pointer to the destination vector
[in]froma const pointer to the source vector
[in]dimthe number of components to copy

Definition at line 248 of file GLUP_context.h.

◆ copy_vector() [3/4]

void GLUP::copy_vector ( GLfloat *  to,
const GLdouble *  from,
index_t  dim 
)
inline

Copies a vector of doubles to a vector of floats.

Parameters
[out]toa pointer to the destination vector
[in]froma const pointer to the source vector
[in]dimthe number of components to copy

Definition at line 236 of file GLUP_context.h.

◆ copy_vector() [4/4]

void GLUP::copy_vector ( GLfloat *  to,
const GLfloat *  from,
index_t  dim 
)
inline

Copies a vector of floats.

Parameters
[out]toa pointer to the destination vector
[in]froma const pointer to the source vector
[in]dimthe number of components to copy

Definition at line 216 of file GLUP_context.h.

◆ invert_matrix() [1/2]

GLboolean GLUP::invert_matrix ( GLdouble  inv[16],
const GLdouble  m[16] 
)

Computes the inverse of a 4x4 matrix.

Parameters
[out]invthe computed inverse of m
[in]mpointer to the input matrix
Return values
GL_TRUEif the matrix m is invertible
GL_FALSEif the matrix m is singular. Then inv receives the transpose of the comatrix of m

◆ invert_matrix() [2/2]

GLboolean GLUP::invert_matrix ( GLfloat  inv[16],
const GLfloat  m[16] 
)

Computes the inverse of a 4x4 matrix.

Parameters
[out]invthe computed inverse of m
[in]mpointer to the input matrix
Return values
GL_TRUEif the matrix m is invertible
GL_FALSEif the matrix m is singular. Then inv receives the transpose of the comatrix of m

◆ load_identity_matrix() [1/2]

void GLUP::load_identity_matrix ( GLdouble  out[16])

Resets a matrix to the identity matrix.

Parameters
[out]outthe matrix to be reset.

◆ load_identity_matrix() [2/2]

void GLUP::load_identity_matrix ( GLfloat  out[16])

Resets a matrix to the identity matrix.

Parameters
[out]outthe matrix to be reset.

◆ mult_matrices() [1/2]

void GLUP::mult_matrices ( GLdouble  out[16],
const GLdouble  m1[16],
const GLdouble  m2[16] 
)

Computes the product of two 4x4 matrices.

Parameters
[out]outthe computed product m1 * m2
[in]m1,m2pointers to the input matrices

◆ mult_matrices() [2/2]

void GLUP::mult_matrices ( GLfloat  out[16],
const GLfloat  m1[16],
const GLfloat  m2[16] 
)

Computes the product of two 4x4 matrices.

Parameters
[out]outthe computed product m1 * m2
[in]m1,m2pointers to the input matrices

◆ mult_matrix_vector() [1/2]

void GLUP::mult_matrix_vector ( GLdouble  out[4],
const GLdouble  m[16],
const GLdouble  v[4] 
)

Computes the product of a 4x4 matrix and a vector.

Parameters
[out]outthe computed product m * v
[in]mpointer to the input matrix
[in]vpointer to the input vector

◆ mult_matrix_vector() [2/2]

void GLUP::mult_matrix_vector ( GLfloat  out[4],
const GLfloat  m[16],
const GLfloat  v[4] 
)

Computes the product of a 4x4 matrix and a vector.

Parameters
[out]outthe computed product m * v
[in]mpointer to the input matrix
[in]vpointer to the input vector \TODO: it seems that in GLSL, w = M*v uses the transpose form, maybe I should change the names !!

◆ mult_transpose_matrix_vector() [1/2]

void GLUP::mult_transpose_matrix_vector ( GLdouble  out[4],
const GLdouble  m[16],
const GLdouble  v[4] 
)

Computes the product of the transpose of a 4x4 matrix and a vector.

Parameters
[out]outthe computed product m * v
[in]mpointer to the input matrix
[in]vpointer to the input vector \TODO: it seems that in GLSL, w = M*v uses this one, maybe I should change the names !!

◆ mult_transpose_matrix_vector() [2/2]

void GLUP::mult_transpose_matrix_vector ( GLfloat  out[4],
const GLfloat  m[16],
const GLfloat  v[4] 
)

Computes the product of the transpose of a 4x4 matrix and a vector.

Parameters
[out]outthe computed product m * v
[in]mpointer to the input matrix
[in]vpointer to the input vector \TODO: it seems that in GLSL, w = M*v uses this one, maybe I should change the names !!

◆ normalize_vector()

void GLUP::normalize_vector ( GLfloat  v[3])
inline

Normalizes a vector.

Parameters
[in,out]va pointer to the 3 coordinates of the 3d vector to be normalized.

Definition at line 259 of file GLUP_context.h.

◆ show_matrix() [1/2]

void GLUP::show_matrix ( const GLdouble  m[16])

For debugging, outputs a matrix to the standard error.

Parameters
[in]mthe matrix to be displayed.

◆ show_matrix() [2/2]

void GLUP::show_matrix ( const GLfloat  m[16])

For debugging, outputs a matrix to the standard error.

Parameters
[in]mthe matrix to be displayed.

◆ show_vector() [1/2]

void GLUP::show_vector ( const GLdouble  v[4])

For debugging, outputs a vector to the standard error.

Parameters
[in]vthe vector to be displayed

◆ show_vector() [2/2]

void GLUP::show_vector ( const GLfloat  v[4])

For debugging, outputs a vector to the standard error.

Parameters
[in]vthe vector to be displayed

◆ transpose_matrix() [1/2]

void GLUP::transpose_matrix ( GLdouble  m[16])

Transposes a matrix in-place.

Parameters
[in,out]ma pointer to the 16 double-precision floating point coefficients of the matrix to be transposed.

◆ transpose_matrix() [2/2]

void GLUP::transpose_matrix ( GLfloat  m[16])

Transposes a matrix in-place.

Parameters
[in,out]ma pointer to the 16 single-precision floating point coefficients of the matrix to be transposed.