mirror of
https://github.com/g-truc/glm.git
synced 2024-11-25 18:04:34 +00:00
Added NewDocs patch
This commit is contained in:
parent
71eaa832ec
commit
c4c558098f
@ -1,4 +1,4 @@
|
||||
/**
|
||||
/*!
|
||||
\defgroup core GLM Core
|
||||
|
||||
\brief The core of GLM, which implements exactly and only the GLSL specification to the degree possible.
|
||||
@ -7,21 +7,26 @@
|
||||
\ref core_funcs "C++ functions that mirror the GLSL functions". It also includes
|
||||
\ref core_precision "a set of precision-based types" that can be used in the appropriate
|
||||
functions. The C++ types are all based on a basic set of \ref core_template "template types".
|
||||
|
||||
The best documentation for GLM Core is the current GLSL specification,
|
||||
<a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.10.6.clean.pdf">version 4.1
|
||||
(pdf file)</a>.
|
||||
There are a few \ref pg_differences "differences" between GLM core and GLSL.
|
||||
**/
|
||||
|
||||
|
||||
/**
|
||||
/*!
|
||||
\defgroup core_types Core GLSL Types
|
||||
|
||||
\brief The standard types defined by the GLSL specification.
|
||||
|
||||
These types are all typedefs of more generalized, template types. To see the definiton
|
||||
of the equivalent template types, go to \ref core_template.
|
||||
of these template types, go to \ref core_template.
|
||||
|
||||
\ingroup core
|
||||
**/
|
||||
|
||||
/**
|
||||
/*!
|
||||
\defgroup core_precision Core Precision Types
|
||||
|
||||
\brief Non-GLSL types that are used to define precision-based types.
|
||||
@ -38,7 +43,7 @@
|
||||
\ingroup core
|
||||
**/
|
||||
|
||||
/**
|
||||
/*!
|
||||
\defgroup core_template Core Template Types
|
||||
|
||||
\brief The generic template types used as the basis for the core types.
|
||||
@ -48,7 +53,7 @@
|
||||
\ingroup core
|
||||
**/
|
||||
|
||||
/**
|
||||
/*!
|
||||
\defgroup core_funcs Core GLSL Functions
|
||||
|
||||
\brief The functions defined by the GLSL specification.
|
||||
|
@ -1,114 +1,500 @@
|
||||
/**
|
||||
\defgroup gtc GLM Core Extensions
|
||||
/*!
|
||||
\defgroup gtx GLM Experimental Extensions
|
||||
|
||||
\brief Functions and types that GLSL does not provide, but are useful to have.
|
||||
|
||||
Core extensions differ from \ref gtx "experimental extensions" in that core extensions
|
||||
are fairly stable. The API for experimental extensions is expected to change
|
||||
significantly between versions.
|
||||
Experimental extensions are useful functions and types, but the development of
|
||||
their API and functionality is not necessarily stable. They can change substantially
|
||||
between versions. Backwards compatibility is not much of an issue for them.
|
||||
|
||||
You can bring all of the extensions, core or experimental, in by
|
||||
including <glm/ext.hpp> Otherwise, you will have to include each extension
|
||||
by including a specific file.
|
||||
**/
|
||||
|
||||
/**
|
||||
\defgroup gtc_half_float Half Float Core Extension
|
||||
\ingroup gtc
|
||||
/*!
|
||||
\defgroup gtx_associated_min_max Associated Min/Max Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Defines the half-float type, along with various typedefs for vectors and matrices.
|
||||
\brief Min and max functions that return associated values not the compared onces.
|
||||
|
||||
You must include <glm/glc/half_float.hpp> to get this functionality.
|
||||
You must include the file <glm/glx/associated_min_max.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/**
|
||||
\defgroup gtc_matrix_access Matrix Access Core Extension
|
||||
\ingroup gtc
|
||||
/*!
|
||||
\defgroup gtx_bit Bitwise Operations Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Defines functions that allow you to access rows or columns of a matrix easily.
|
||||
\brief Allow to perform bit operations on integer values
|
||||
|
||||
You must include <glm/glc/matrix_access.hpp> to get this functionality.
|
||||
You must include the file <glm/glx/bit.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/**
|
||||
\defgroup gtc_matrix_integer Integer Matrix Core Extension
|
||||
\ingroup gtc
|
||||
/*!
|
||||
\defgroup gtx_closest_point Find Closest Point Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Defines a number of matrices with integer types.
|
||||
|
||||
You must include <glm/glc/matrix_integer.hpp> to get this functionality.
|
||||
\brief Find the point on a straight line which is the closet of a point.
|
||||
|
||||
You must include the file <glm/glx/closest_point.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/**
|
||||
\defgroup gtc_matrix_inverse Matrix Inverse Core Extension
|
||||
\ingroup gtc
|
||||
/*!
|
||||
\defgroup gtx_color_cast Color Conversion Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Defines additional matrix inverting functions.
|
||||
|
||||
You must include <glm/glc/matrix_inverse.hpp> to get this functionality.
|
||||
\brief Conversion between two color types.
|
||||
|
||||
You must include the file <glm/glx/color_cast.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/**
|
||||
\defgroup gtc_matrix_transform Matrix Transform Core Extension
|
||||
\ingroup gtc
|
||||
/*!
|
||||
\defgroup gtx_color_space RGB to HSV Conversion Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Defines functions that generate common transformation matrices.
|
||||
|
||||
The matrices generated by this extension use standard OpenGL fixed-function
|
||||
conventions. For example, the lookAt function generates a transform from world
|
||||
space into the specific eye space that the projective matrix functions (
|
||||
perspective, ortho, etc) are designed to expect. The OpenGL compatibility
|
||||
specifications defines the particular layout of this eye space.
|
||||
|
||||
You must include <glm/glc/matrix_transform.hpp> to get this functionality.
|
||||
\brief Related to RGB to HSV conversions and operations.
|
||||
|
||||
You must include the file <glm/glx/color_space.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/**
|
||||
\defgroup gtc_quaternion Quaternion Core Extension
|
||||
\ingroup gtc
|
||||
/*!
|
||||
\defgroup gtx_color_space_YCoCg RGB to YCoCg Conversion Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Defines a templated quaternion type and several quaternion operations.
|
||||
|
||||
You must include <glm/glc/quaternion.hpp> to get this functionality.
|
||||
\brief RGB to YCoCg conversions and operations
|
||||
|
||||
You must include the file <glm/glx/color_space_YCoCg.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/**
|
||||
\defgroup gtc_type_precision Type Precision Core Extension
|
||||
\ingroup gtc
|
||||
/*!
|
||||
\defgroup gtx_compatibility Cg and HLSL Compatibility Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Defines specific C++-based precision types.
|
||||
|
||||
\ref core_precision defines types based on GLSL's precision qualifiers. This
|
||||
extension defines types based on explicitly-sized C++ data types.
|
||||
|
||||
You must include the file <glm/glc/type_precision.hpp> to get this functionality.
|
||||
\brief Provide functions to increase the compatibility with Cg and HLSL languages
|
||||
|
||||
You must include the file <glm/glx/compatibility.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/**
|
||||
\defgroup gtc_type_ptr Pointer Access Core Extension
|
||||
\ingroup gtc
|
||||
/*!
|
||||
\defgroup gtx_component_wise Component Wise Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Used to get a pointer to the memory layout of a basic type.
|
||||
|
||||
This extension defines an overloaded function, glm::value_ptr, which
|
||||
takes any of the \ref core_template "core template types". It returns
|
||||
a pointer to the memory layout of the object. Matrix types store their values
|
||||
in row-major order.
|
||||
|
||||
This is useful for uploading data to matrices or copying data to buffer objects.
|
||||
|
||||
Example:
|
||||
|
||||
\code
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/glc/type_ptr.hpp>
|
||||
glm::vec3 aVector(3);
|
||||
glm::mat4 someMatrix(1.0);
|
||||
\brief Operations between components of a type
|
||||
|
||||
glUniform3fv(uniformLoc, 1, glm::value_ptr(aVector));
|
||||
glUniformMatrix4fv(uniformMatrixLoc, 1, GL_FALSE, glm::value_ptr(someMatrix));
|
||||
\endcode
|
||||
|
||||
You must include the file <glm/glc/type_ptr.hpp> to get this functionality.
|
||||
You must include the file <glm/glx/component_wise.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/*!
|
||||
\defgroup gtx_epsilon Epsilon Comparison Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Comparison functions for a user defined epsilon values.
|
||||
|
||||
You must include the file <glm/glx/epsilon.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/*!
|
||||
\defgroup gtx_euler_angles Matrix From Euler Angles Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Build matrices from Euler angles.
|
||||
|
||||
You must include the file <glm/glx/euler_angles.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/*!
|
||||
\defgroup gtx_extend Position Extending Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Extend a position from a source to a position at a defined length.
|
||||
|
||||
You must include the file <glm/glx/extend.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/*!
|
||||
\defgroup gtx_extented_min_max Extended Min Max Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Min and max functions for 3 to 4 parameters.
|
||||
|
||||
You must include the file <glm/glx/extented_min_max.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/*!
|
||||
\defgroup gtx_fast_exponential Fast Exponentiation Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Fast but less accurate implementations of exponential based functions.
|
||||
|
||||
You must include the file <glm/glx/fast_exponential.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/*!
|
||||
\defgroup gtx_fast_square_root Fast Square Root Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Fast but less accurate implementations of square root based functions.
|
||||
|
||||
You must include the file <glm/glx/fast_square_root.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/*!
|
||||
\defgroup gtx_fast_trigonometry Fast Trig Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Fast but less accurate implementations of trigonometric functions.
|
||||
|
||||
You must include the file <glm/glx/fast_trigonometry.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/*!
|
||||
\defgroup gtx_handed_coordinate_space Space Handedness Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief To know if a set of three basis vectors defines a right or left-handed coordinate system.
|
||||
|
||||
You must include the file <glm/glx/handed_coordinate_system.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/*!
|
||||
\defgroup gtx_inertia Intertial Matrix Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Create inertia matrices
|
||||
|
||||
You must include the file <glm/glx/inertia.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/*!
|
||||
\defgroup gtx_int_10_10_10_2 Packed Integer Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Add support for integer for core functions
|
||||
|
||||
You must include the file <glm/glx/int_10_10_10_2.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/*!
|
||||
\defgroup gtx_integer Integer Function Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Add support for integer for core functions
|
||||
|
||||
You must include the file <glm/glx/integer.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/*!
|
||||
\defgroup gtx_intersect Intersection Test Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Add intersection functions
|
||||
|
||||
You must include the file <glm/glx/intersect.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/*!
|
||||
\defgroup gtx_log_base Log With Base Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Logarithm for any base. base can be a vector or a scalar.
|
||||
|
||||
You must include the file <glm/glx/log_base.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/*!
|
||||
\defgroup gtx_matrix_cross_product Cross Product Matrices Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Build cross product matrices
|
||||
|
||||
You must include the file <glm/glx/matrix_cross_product.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/*!
|
||||
\defgroup gtx_matrix_major_storage Build Matrix Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Build matrices with specific matrix order, row or column
|
||||
|
||||
You must include the file <glm/glx/matrix_major_storage.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/*!
|
||||
\defgroup gtx_matrix_operation Diagonal Matrix Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Build diagonal matrices from vectors.
|
||||
|
||||
You must include the file <glm/glx/matrix_operation.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/*!
|
||||
\defgroup gtx_matrix_query Query Matrix Properties Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Query to evaluate matrix properties
|
||||
|
||||
You must include the file <glm/glx/matrix_query.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/*!
|
||||
\defgroup gtx_mixed_product Mixed Product Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Mixed product of 3 vectors.
|
||||
|
||||
You must include the file <glm/glx/mixed_product.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/*!
|
||||
\defgroup gtx_multiple Multiples Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Find the closest number of a number multiple of other number.
|
||||
|
||||
You must include the file <glm/glx/multiple.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/*!
|
||||
\defgroup gtx_norm Vector Norm Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Various way to compute vector norms.
|
||||
|
||||
You must include the file <glm/glx/norm.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/*!
|
||||
\defgroup gtx_normal Compute Normal Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Compute the normal of a triangle.
|
||||
|
||||
You must include the file <glm/glx/normal.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/*!
|
||||
\defgroup gtx_normalize_dot Normalize Dot Product Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Dot product of vectors that need to be normalize with a single square root.
|
||||
|
||||
You must include the file <glm/glx/normalized_dot.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/*!
|
||||
\defgroup gtx_number_precision Number Precision Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Defined size types.
|
||||
|
||||
You must include the file <glm/glx/number_precision.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/*!
|
||||
\defgroup gtx_ocl_type OpenCL Types Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief OpenCL types.
|
||||
|
||||
You must include the file <glm/glx/ocl_type.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/*!
|
||||
\defgroup gtx_optimum_pow Optimum Pow Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Integer exponentiation of power functions.
|
||||
|
||||
You must include the file <glm/glx/optimum_pow.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/*!
|
||||
\defgroup gtx_orthonormalize Orthonormalize Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Orthonormalize matrices.
|
||||
|
||||
You must include the file <glm/glx/orthonormalize.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/*!
|
||||
\defgroup gtx_perpendicular Perpendicular Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Perpendicular of a vector from other one
|
||||
|
||||
You must include the file <glm/glx/perpendicular.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/*!
|
||||
\defgroup gtx_polar_coordinates Polar Coordinates Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Conversion from Euclidean space to polar space and revert.
|
||||
|
||||
You must include the file <glm/glx/polar_coordinates.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/*!
|
||||
\defgroup gtx_projection Projection Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Projection of a vector to other one
|
||||
|
||||
You must include the file <glm/glx/projection.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/*!
|
||||
\defgroup gtx_quaternion Quaternion Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Quaternion types and functions
|
||||
|
||||
You must include the file <glm/glx/quaternion.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/*!
|
||||
\defgroup gtx_random Random Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Generate random number from various distribution methods
|
||||
|
||||
You must include the file <glm/glx/random.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/*!
|
||||
\defgroup gtx_raw_data Raw Data Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Projection of a vector to other one
|
||||
|
||||
You must include the file <glm/glx/raw_data.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/*!
|
||||
\defgroup gtx_reciprocal Reciprocal Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Define secant, cosecant and cotangent functions.
|
||||
|
||||
You must include the file <glm/glx/reciprocal.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/*!
|
||||
\defgroup gtx_rotate_vector Rotate Vector Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Function to directly rotate a vector
|
||||
|
||||
You must include the file <glm/glx/rotate_vector.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/*!
|
||||
\defgroup gtx_simd_mat4 SIMD Mat4 Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief SIMD implementation of mat4 type.
|
||||
|
||||
You must include the file <glm/glx/simd_mat4.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/*!
|
||||
\defgroup gtx_simd_vec4 SIMD Vec4 Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief SIMD implementation of vec4 type.
|
||||
|
||||
You must include the file <glm/glx/simd_vec4.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/*!
|
||||
\defgroup gtx_spline Spline Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Spline functions
|
||||
|
||||
You must include the file <glm/glx/spline.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/*!
|
||||
\defgroup gtx_string_cast String Cast Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Setup strings for GLM type values
|
||||
|
||||
You must include the file <glm/glx/transform.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/*!
|
||||
\defgroup gtx_transform Transformation Matrices Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Add transformation matrices
|
||||
|
||||
You must include the file <glm/glx/transform2.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/*!
|
||||
\defgroup gtx_transform2 Extra Transform Matrices Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Add extra transformation matrices
|
||||
|
||||
You must include the file <glm/glx/unsigned_int.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/*!
|
||||
\defgroup gtx_unsigned_int Unsigned Int Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Add support for unsigned integer for core functions
|
||||
|
||||
You must include the file <glm/glx/unsigned_int.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/*!
|
||||
\defgroup gtx_vector_access Vector Access Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Function to set values to vectors
|
||||
|
||||
You must include the file <glm/glx/vector_access.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/*!
|
||||
\defgroup gtx_vector_angle Vector Angle Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Compute angle between vectors
|
||||
|
||||
You must include the file <glm/glx/vector_angle.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/*!
|
||||
\defgroup gtx_vector_query Vector Query Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Query informations of vector types
|
||||
|
||||
You must include the file <glm/glx/vector_query.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/*!
|
||||
\defgroup gtx_verbose_operator Verbose Operator Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Use words to replace operators
|
||||
|
||||
You must include the file <glm/glx/verbose_operator.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/*!
|
||||
\defgroup gtx_wrap Wrap Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Wrapping mode using my texture samping.
|
||||
|
||||
You must include the file <glm/glx/wrap.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
|
@ -1,500 +1,114 @@
|
||||
/**
|
||||
\defgroup gtx GLM Experimental Extensions
|
||||
/*!
|
||||
\defgroup gtc GLM Core Extensions
|
||||
|
||||
\brief Functions and types that GLSL does not provide, but are useful to have.
|
||||
|
||||
Experimental extensions are useful functions and types, but the development of
|
||||
their API and functionality is not necessarily stable. They can change substantially
|
||||
between versions. Backwards compatibility is not much of an issue for them.
|
||||
Core extensions differ from \ref gtx "experimental extensions" in that core extensions
|
||||
are fairly stable. The API for experimental extensions is expected to change
|
||||
significantly between versions.
|
||||
|
||||
You can bring all of the extensions, core or experimental, in by
|
||||
including <glm/ext.hpp> Otherwise, you will have to include each extension
|
||||
by including a specific file.
|
||||
**/
|
||||
|
||||
/**
|
||||
\defgroup gtx_associated_min_max Associated Min/Max Experimental Extension
|
||||
\ingroup gtx
|
||||
/*!
|
||||
\defgroup gtc_half_float Half Float Core Extension
|
||||
\ingroup gtc
|
||||
|
||||
\brief Min and max functions that return associated values not the compared onces.
|
||||
\brief Defines the half-float type, along with various typedefs for vectors and matrices.
|
||||
|
||||
You must include the file <glm/glx/associated_min_max.hpp> to get this functionality.
|
||||
You must include <glm/glc/half_float.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/**
|
||||
\defgroup gtx_bit Bitwise Operations Experimental Extension
|
||||
\ingroup gtx
|
||||
/*!
|
||||
\defgroup gtc_matrix_access Matrix Access Core Extension
|
||||
\ingroup gtc
|
||||
|
||||
\brief Allow to perform bit operations on integer values
|
||||
\brief Defines functions that allow you to access rows or columns of a matrix easily.
|
||||
|
||||
You must include the file <glm/glx/bit.hpp> to get this functionality.
|
||||
You must include <glm/glc/matrix_access.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/**
|
||||
\defgroup gtx_closest_point Find Closest Point Experimental Extension
|
||||
\ingroup gtx
|
||||
/*!
|
||||
\defgroup gtc_matrix_integer Integer Matrix Core Extension
|
||||
\ingroup gtc
|
||||
|
||||
\brief Find the point on a straight line which is the closet of a point.
|
||||
|
||||
You must include the file <glm/glx/closest_point.hpp> to get this functionality.
|
||||
\brief Defines a number of matrices with integer types.
|
||||
|
||||
You must include <glm/glc/matrix_integer.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/**
|
||||
\defgroup gtx_color_cast Color Conversion Experimental Extension
|
||||
\ingroup gtx
|
||||
/*!
|
||||
\defgroup gtc_matrix_inverse Matrix Inverse Core Extension
|
||||
\ingroup gtc
|
||||
|
||||
\brief Conversion between two color types.
|
||||
|
||||
You must include the file <glm/glx/color_cast.hpp> to get this functionality.
|
||||
\brief Defines additional matrix inverting functions.
|
||||
|
||||
You must include <glm/glc/matrix_inverse.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/**
|
||||
\defgroup gtx_color_space RGB to HSV Conversion Experimental Extension
|
||||
\ingroup gtx
|
||||
/*!
|
||||
\defgroup gtc_matrix_transform Matrix Transform Core Extension
|
||||
\ingroup gtc
|
||||
|
||||
\brief Related to RGB to HSV conversions and operations.
|
||||
|
||||
You must include the file <glm/glx/color_space.hpp> to get this functionality.
|
||||
\brief Defines functions that generate common transformation matrices.
|
||||
|
||||
The matrices generated by this extension use standard OpenGL fixed-function
|
||||
conventions. For example, the lookAt function generates a transform from world
|
||||
space into the specific eye space that the projective matrix functions (
|
||||
perspective, ortho, etc) are designed to expect. The OpenGL compatibility
|
||||
specifications defines the particular layout of this eye space.
|
||||
|
||||
You must include <glm/glc/matrix_transform.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/**
|
||||
\defgroup gtx_color_space_YCoCg RGB to YCoCg Conversion Experimental Extension
|
||||
\ingroup gtx
|
||||
/*!
|
||||
\defgroup gtc_quaternion Quaternion Core Extension
|
||||
\ingroup gtc
|
||||
|
||||
\brief RGB to YCoCg conversions and operations
|
||||
|
||||
You must include the file <glm/glx/color_space_YCoCg.hpp> to get this functionality.
|
||||
\brief Defines a templated quaternion type and several quaternion operations.
|
||||
|
||||
You must include <glm/glc/quaternion.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/**
|
||||
\defgroup gtx_compatibility Cg and HLSL Compatibility Experimental Extension
|
||||
\ingroup gtx
|
||||
/*!
|
||||
\defgroup gtc_type_precision Type Precision Core Extension
|
||||
\ingroup gtc
|
||||
|
||||
\brief Provide functions to increase the compatibility with Cg and HLSL languages
|
||||
|
||||
You must include the file <glm/glx/compatibility.hpp> to get this functionality.
|
||||
\brief Defines specific C++-based precision types.
|
||||
|
||||
\ref core_precision defines types based on GLSL's precision qualifiers. This
|
||||
extension defines types based on explicitly-sized C++ data types.
|
||||
|
||||
You must include the file <glm/glc/type_precision.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/**
|
||||
\defgroup gtx_component_wise Component Wise Experimental Extension
|
||||
\ingroup gtx
|
||||
/*!
|
||||
\defgroup gtc_type_ptr Pointer Access Core Extension
|
||||
\ingroup gtc
|
||||
|
||||
\brief Operations between components of a type
|
||||
\brief Used to get a pointer to the memory layout of a basic type.
|
||||
|
||||
This extension defines an overloaded function, glm::value_ptr, which
|
||||
takes any of the \ref core_template "core template types". It returns
|
||||
a pointer to the memory layout of the object. Matrix types store their values
|
||||
in row-major order.
|
||||
|
||||
This is useful for uploading data to matrices or copying data to buffer objects.
|
||||
|
||||
Example:
|
||||
|
||||
\code
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/glc/type_ptr.hpp>
|
||||
glm::vec3 aVector(3);
|
||||
glm::mat4 someMatrix(1.0);
|
||||
|
||||
You must include the file <glm/glx/component_wise.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/**
|
||||
\defgroup gtx_epsilon Epsilon Comparison Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Comparison functions for a user defined epsilon values.
|
||||
|
||||
You must include the file <glm/glx/epsilon.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/**
|
||||
\defgroup gtx_euler_angles Matrix From Euler Angles Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Build matrices from Euler angles.
|
||||
|
||||
You must include the file <glm/glx/euler_angles.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/**
|
||||
\defgroup gtx_extend Position Extending Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Extend a position from a source to a position at a defined length.
|
||||
|
||||
You must include the file <glm/glx/extend.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/**
|
||||
\defgroup gtx_extented_min_max Extended Min Max Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Min and max functions for 3 to 4 parameters.
|
||||
|
||||
You must include the file <glm/glx/extented_min_max.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/**
|
||||
\defgroup gtx_fast_exponential Fast Exponentiation Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Fast but less accurate implementations of exponential based functions.
|
||||
|
||||
You must include the file <glm/glx/fast_exponential.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/**
|
||||
\defgroup gtx_fast_square_root Fast Square Root Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Fast but less accurate implementations of square root based functions.
|
||||
|
||||
You must include the file <glm/glx/fast_square_root.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/**
|
||||
\defgroup gtx_fast_trigonometry Fast Trig Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Fast but less accurate implementations of trigonometric functions.
|
||||
|
||||
You must include the file <glm/glx/fast_trigonometry.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/**
|
||||
\defgroup gtx_handed_coordinate_space Space Handedness Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief To know if a set of three basis vectors defines a right or left-handed coordinate system.
|
||||
|
||||
You must include the file <glm/glx/handed_coordinate_system.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/**
|
||||
\defgroup gtx_inertia Intertial Matrix Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Create inertia matrices
|
||||
|
||||
You must include the file <glm/glx/inertia.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/**
|
||||
\defgroup gtx_int_10_10_10_2 Packed Integer Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Add support for integer for core functions
|
||||
|
||||
You must include the file <glm/glx/int_10_10_10_2.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/**
|
||||
\defgroup gtx_integer Integer Function Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Add support for integer for core functions
|
||||
|
||||
You must include the file <glm/glx/integer.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/**
|
||||
\defgroup gtx_intersect Intersection Test Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Add intersection functions
|
||||
|
||||
You must include the file <glm/glx/intersect.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/**
|
||||
\defgroup gtx_log_base Log With Base Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Logarithm for any base. base can be a vector or a scalar.
|
||||
|
||||
You must include the file <glm/glx/log_base.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/**
|
||||
\defgroup gtx_matrix_cross_product Cross Product Matrices Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Build cross product matrices
|
||||
|
||||
You must include the file <glm/glx/matrix_cross_product.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/**
|
||||
\defgroup gtx_matrix_major_storage Build Matrix Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Build matrices with specific matrix order, row or column
|
||||
|
||||
You must include the file <glm/glx/matrix_major_storage.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/**
|
||||
\defgroup gtx_matrix_operation Diagonal Matrix Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Build diagonal matrices from vectors.
|
||||
|
||||
You must include the file <glm/glx/matrix_operation.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/**
|
||||
\defgroup gtx_matrix_query Query Matrix Properties Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Query to evaluate matrix properties
|
||||
|
||||
You must include the file <glm/glx/matrix_query.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/**
|
||||
\defgroup gtx_mixed_product Mixed Product Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Mixed product of 3 vectors.
|
||||
|
||||
You must include the file <glm/glx/mixed_product.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/**
|
||||
\defgroup gtx_multiple Multiples Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Find the closest number of a number multiple of other number.
|
||||
|
||||
You must include the file <glm/glx/multiple.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/**
|
||||
\defgroup gtx_norm Vector Norm Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Various way to compute vector norms.
|
||||
|
||||
You must include the file <glm/glx/norm.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/**
|
||||
\defgroup gtx_normal Compute Normal Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Compute the normal of a triangle.
|
||||
|
||||
You must include the file <glm/glx/normal.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/**
|
||||
\defgroup gtx_normalize_dot Normalize Dot Product Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Dot product of vectors that need to be normalize with a single square root.
|
||||
|
||||
You must include the file <glm/glx/normalized_dot.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/**
|
||||
\defgroup gtx_number_precision Number Precision Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Defined size types.
|
||||
|
||||
You must include the file <glm/glx/number_precision.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/**
|
||||
\defgroup gtx_ocl_type OpenCL Types Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief OpenCL types.
|
||||
|
||||
You must include the file <glm/glx/ocl_type.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/**
|
||||
\defgroup gtx_optimum_pow Optimum Pow Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Integer exponentiation of power functions.
|
||||
|
||||
You must include the file <glm/glx/optimum_pow.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/**
|
||||
\defgroup gtx_orthonormalize Orthonormalize Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Orthonormalize matrices.
|
||||
|
||||
You must include the file <glm/glx/orthonormalize.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/**
|
||||
\defgroup gtx_perpendicular Perpendicular Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Perpendicular of a vector from other one
|
||||
|
||||
You must include the file <glm/glx/perpendicular.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/**
|
||||
\defgroup gtx_polar_coordinates Polar Coordinates Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Conversion from Euclidean space to polar space and revert.
|
||||
|
||||
You must include the file <glm/glx/polar_coordinates.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/**
|
||||
\defgroup gtx_projection Projection Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Projection of a vector to other one
|
||||
|
||||
You must include the file <glm/glx/projection.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/**
|
||||
\defgroup gtx_quaternion Quaternion Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Quaternion types and functions
|
||||
|
||||
You must include the file <glm/glx/quaternion.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/**
|
||||
\defgroup gtx_random Random Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Generate random number from various distribution methods
|
||||
|
||||
You must include the file <glm/glx/random.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/**
|
||||
\defgroup gtx_raw_data Raw Data Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Projection of a vector to other one
|
||||
|
||||
You must include the file <glm/glx/raw_data.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/**
|
||||
\defgroup gtx_reciprocal Reciprocal Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Define secant, cosecant and cotangent functions.
|
||||
|
||||
You must include the file <glm/glx/reciprocal.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/**
|
||||
\defgroup gtx_rotate_vector Rotate Vector Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Function to directly rotate a vector
|
||||
|
||||
You must include the file <glm/glx/rotate_vector.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/**
|
||||
\defgroup gtx_simd_mat4 SIMD Mat4 Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief SIMD implementation of mat4 type.
|
||||
|
||||
You must include the file <glm/glx/simd_mat4.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/**
|
||||
\defgroup gtx_simd_vec4 SIMD Vec4 Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief SIMD implementation of vec4 type.
|
||||
|
||||
You must include the file <glm/glx/simd_vec4.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/**
|
||||
\defgroup gtx_spline Spline Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Spline functions
|
||||
|
||||
You must include the file <glm/glx/spline.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/**
|
||||
\defgroup gtx_string_cast String Cast Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Setup strings for GLM type values
|
||||
|
||||
You must include the file <glm/glx/transform.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/**
|
||||
\defgroup gtx_transform Transformation Matrices Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Add transformation matrices
|
||||
|
||||
You must include the file <glm/glx/transform2.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/**
|
||||
\defgroup gtx_transform2 Extra Transform Matrices Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Add extra transformation matrices
|
||||
|
||||
You must include the file <glm/glx/unsigned_int.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/**
|
||||
\defgroup gtx_unsigned_int Unsigned Int Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Add support for unsigned integer for core functions
|
||||
|
||||
You must include the file <glm/glx/unsigned_int.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/**
|
||||
\defgroup gtx_vector_access Vector Access Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Function to set values to vectors
|
||||
|
||||
You must include the file <glm/glx/vector_access.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/**
|
||||
\defgroup gtx_vector_angle Vector Angle Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Compute angle between vectors
|
||||
|
||||
You must include the file <glm/glx/vector_angle.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/**
|
||||
\defgroup gtx_vector_query Vector Query Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Query informations of vector types
|
||||
|
||||
You must include the file <glm/glx/vector_query.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/**
|
||||
\defgroup gtx_verbose_operator Verbose Operator Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Use words to replace operators
|
||||
|
||||
You must include the file <glm/glx/verbose_operator.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
/**
|
||||
\defgroup gtx_wrap Wrap Experimental Extension
|
||||
\ingroup gtx
|
||||
|
||||
\brief Wrapping mode using my texture samping.
|
||||
|
||||
You must include the file <glm/glx/wrap.hpp> to get this functionality.
|
||||
glUniform3fv(uniformLoc, 1, glm::value_ptr(aVector));
|
||||
glUniformMatrix4fv(uniformMatrixLoc, 1, GL_FALSE, glm::value_ptr(someMatrix));
|
||||
\endcode
|
||||
|
||||
You must include the file <glm/glc/type_ptr.hpp> to get this functionality.
|
||||
**/
|
||||
|
||||
|
784
doc/pages.doxy
784
doc/pages.doxy
@ -1,89 +1,48 @@
|
||||
/**
|
||||
/*!
|
||||
\mainpage OpenGL Mathematics
|
||||
OpenGL Mathematics (GLM) is a C++ mathematics library for 3D applications based
|
||||
on the OpenGL Shading Language (GLSL) specification.
|
||||
|
||||
GLM provides 3D programmers with math classes and functions that are similar to
|
||||
GLSL or any high level GPU programming language. The idea is to have a library
|
||||
that has identical naming conventions and functionalities than GLSL so that when
|
||||
developers know GLSL, they know how to use GLM.
|
||||
|
||||
GLM is not limited strictly to GLSL features.
|
||||
OpenGL Mathematics (GLM) is a C++ mathematics library for graphics software based on the OpenGL Shading Language (GLSL) specification.
|
||||
|
||||
GLM provides classes and functions designed and implemented with the same naming conventions and functionalities than GLSL so that when a programmer knows GLSL, he knows GLM as well which makes it really easy to use.
|
||||
|
||||
This project isn't limited by GLSL features. An extension system, based on the GLSL extension conventions, provides extended capabilities: matrix transformations, quaternions, half-based types, random numbers, etc...
|
||||
|
||||
This library works perfectly with OpenGL but it also ensures interoperability with other third party libraries and SDK. It is a good candidate for software rendering (Raytracing / Rasterisation), image processing, physic simulations and any context that requires a simple and convenient mathematics library.
|
||||
|
||||
GLM is written as a platform independent library with no dependence and officially supports the following compilers:
|
||||
1. GCC 3.4 and higher
|
||||
2. LLVM 2.3 and higher
|
||||
3. Visual Studio 2005 and higher
|
||||
|
||||
The source code is licenced under the <a href="http://www.opensource.org/licenses/mit-license.php">MIT licence</a>.
|
||||
|
||||
Thanks for contributing to the project by submitting tickets for bug reports and feature requests. (SF.net account required). Any feedback is welcome at glm@g-truc.net.
|
||||
|
||||
However, this project isn't limited by GLSL features. An extension system, based
|
||||
on the GLSL extension conventions, allows extended capabilities.
|
||||
|
||||
This library can be used with OpenGL but also for software rendering (Raytracing
|
||||
/ Rasterisation), image processing and as much contexts as a simple math library
|
||||
could be used for.
|
||||
|
||||
GLM is written as a platform independent library. The following compilers are
|
||||
officially supported:
|
||||
\li GNU GCC 3.4 and higher
|
||||
\li Microsoft Visual Studio 8.0 and higher
|
||||
|
||||
The source code is under the
|
||||
<a href="http://www.opensource.org/licenses/mit-license.php">MIT licence</a>.
|
||||
|
||||
Any feedback is welcome and can be sent to glm@g-truc.net.
|
||||
|
||||
\li \subpage started
|
||||
\li \subpage faq
|
||||
\li \subpage issues
|
||||
\li \subpage reference
|
||||
\li \subpage pg_started
|
||||
\li \subpage pg_advanced
|
||||
\li \subpage pg_differences
|
||||
\li \subpage pg_deprecated
|
||||
\li \subpage pg_issues
|
||||
\li \subpage pg_faq
|
||||
\li \subpage pg_samples
|
||||
\li \subpage pg_reference
|
||||
**/
|
||||
|
||||
/**
|
||||
\page started Getting Started
|
||||
/*!
|
||||
\page pg_started Getting Started
|
||||
|
||||
\section started_compiler Compiler Setup
|
||||
|
||||
GLM is a header library. Therefore, it doesn't require to be built separately. All that
|
||||
is necessary to use GLM is to add the GLM install path to your compiler's include
|
||||
search paths. (-I option with GCC) Alternatively, you can copy the GLM files directly into your
|
||||
project's source directory.
|
||||
|
||||
GLM makes heavy use of C++ templates. This may significantly increase the compile
|
||||
time for files that use GLM. If this is a problem for your needs, precompiled headers
|
||||
are a good solution for avoiding this issue.
|
||||
|
||||
\section started_core Core Features
|
||||
|
||||
After initial compiler setup, all core features of GLM (core GLSL features) can be accessed
|
||||
by including the glm.hpp header. The line: #include <glm/glm.hpp> is used for a typical
|
||||
compiler setup.
|
||||
|
||||
Note that by default there are no dependencies on external headers like gl.h, gl3.h, glu.h or
|
||||
windows.h.
|
||||
|
||||
\section started_swizzle Setup of Swizzle Operators
|
||||
|
||||
A common feature of shader languages like GLSL is components swizzling. This involves
|
||||
being able to select which components of a vector are used and in what order. For
|
||||
example, "variable.x", "variable.xxy", "variable.zxyy" are examples of swizzling.
|
||||
|
||||
However in GLM, swizzling operators are disabled by default. To enable swizzling the
|
||||
define GLM_SWIZZLE must be defined to one of GLM_SWIZZLE_XYZW, GLM_SWIZZLE_RGBA,
|
||||
GLM_SWIZZLE_STQP or GLM_SWIZZLE_FULL depending on what swizzle syntax is required.
|
||||
|
||||
To enable swizzling, it is suggested that setup.hpp be included first, then custom
|
||||
settings and finally glm.hpp. For
|
||||
example:
|
||||
|
||||
\code
|
||||
#include <glm/setup.hpp>
|
||||
#define GLM_SWIZZLE GLM_SWIZZLE_FULL
|
||||
#include <glm/glm.hpp>
|
||||
\endcode
|
||||
|
||||
These custom setup lines can then be placed in a common project header or precompiled
|
||||
header.
|
||||
|
||||
\section started_sample Basic Use of GLM Core
|
||||
|
||||
\code
|
||||
#include <glm/glm.hpp>
|
||||
GLM is a header only library, there is nothing to build to use it which increases its cross platform capabilities.
|
||||
|
||||
To use GLM, a programmer only has to include <glm/glm.hpp>. This provides all the GLSL features implemented by GLM.
|
||||
|
||||
GLM makes heavy usages of C++ templates. This design may significantly increase the compile time for files that use GLM. Precompiled headers are recommended to avoid this issue.
|
||||
|
||||
\section started_sample Use Sample of GLM Core
|
||||
\code
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
int foo()
|
||||
{
|
||||
glm::vec4 Position = glm::vec4(glm::vec3(0.0), 1.0);
|
||||
@ -94,15 +53,23 @@ int foo()
|
||||
}
|
||||
\endcode
|
||||
|
||||
\section started_dependencies Dependencies
|
||||
|
||||
When <glm/glm.hpp> is included, GLM provides all the GLSL features it implements in C++.
|
||||
|
||||
When an extension is included, all the dependent extensions will be included as well. All the extensions depend on GLM core. (<glm/glm.hpp>)
|
||||
|
||||
There is no dependence with external libraries or external headers like gl.h, gl3.h, glu.h or windows.h. However, if <boost/static_assert.hpp> is included, Boost static assert will be used throughout GLM code to provide compiled time errors.
|
||||
|
||||
\section started_extensions GLM Extensions
|
||||
|
||||
GLM extends the core GLSL feature set with extensions. These extensions include:
|
||||
quaternion, transformation, spline, matrix inverse, color spaces, etc.
|
||||
Note that some extensions are incompatible with other extension as and may result in C++
|
||||
name collisions when used together.
|
||||
GLM extends the core GLSL feature set with extensions. These extensions include: \ref gtc_quaternion "quaternion", \ref gtc_matrix_transform "transformation", \ref gtx_spline "spline", \ref gtc_matrix_inverse "matrix inverse", \ref gtx_color_space "color spaces", etc.
|
||||
|
||||
To use a particular extension, simply include the extension header file. All
|
||||
extension features are added to the glm namespace.
|
||||
Note that some extensions are incompatible with other extensions; this may result in C++ name collisions when used together.
|
||||
|
||||
GLM provides two methods to use these extensions.
|
||||
|
||||
This method simply requires the inclusion of the extension implementation filename. The extension features are added to the GLM namespace.
|
||||
|
||||
\code
|
||||
#include <glm/glm.hpp>
|
||||
@ -111,150 +78,626 @@ int foo()
|
||||
int foo()
|
||||
{
|
||||
glm::vec4 Position = glm::vec4(glm::vec3(0.0f), 1.0f);
|
||||
glm::mat4 Model = glm::translate(1.0f, 1.0f, 1.0f);
|
||||
glm::mat4 Model = glm::translate(
|
||||
glm::mat4(1.0f), glm::vec3(1.0f));
|
||||
glm::vec4 Transformed = Model * Position;
|
||||
return 0;
|
||||
}
|
||||
\endcode
|
||||
|
||||
\section started_depend Dependencies
|
||||
|
||||
When <glm/glm.hpp> is included, GLM provides all the GLSL features it implements in C++.
|
||||
\section started_interop OpenGL Interoperability
|
||||
|
||||
By including <glm/ext.hpp> all the features of all extensions of GLM are included.
|
||||
It could be possible to implement <tt>glVertex3fv(glm::vec3(0))</tt> in C++ with the appropriate cast operator. It would result as a transparent cast in this example; however, cast operator may result in programs running with unexpected behaviors without build errors or any notification.
|
||||
|
||||
The \ref gtc_type_ptr extension provides a safe solution:
|
||||
|
||||
When you include a specific extension, all the dependent extensions will be included as well.
|
||||
All the extensions depend on GLM core. (<glm/glm.hpp>)
|
||||
|
||||
GLM has no dependencies on external libraries. However, if <boost/static_assert.hpp> is
|
||||
included before the GLM headers, boost::static_assert will be used all over GLM code.
|
||||
\code
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/type_ptr.hpp>
|
||||
|
||||
void foo()
|
||||
{
|
||||
glm::vec4 v(0.0f);
|
||||
glm::mat4 m(1.0f);
|
||||
...
|
||||
glVertex3fv(glm::value_ptr(v))
|
||||
glLoadMatrixfv(glm::value_ptr(m));
|
||||
}
|
||||
\endcode
|
||||
|
||||
Another solution inspired by STL:
|
||||
|
||||
\code
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
void foo()
|
||||
{
|
||||
glm::vec4 v(0.0f);
|
||||
glm::mat4 m(1.0f);
|
||||
...
|
||||
glVertex3fv(&v[0]);
|
||||
glLoadMatrixfv(&m[0][0]);
|
||||
}
|
||||
\endcode
|
||||
**/
|
||||
|
||||
/**
|
||||
\page faq FAQ
|
||||
/*!
|
||||
\page pg_advanced Advaned Usage
|
||||
|
||||
\section faq1 Why GLM follows GLSL specification and conventions?
|
||||
\section advanced_swizzle Swizzle Operators
|
||||
|
||||
Following GLSL conventions is a really strict policy of GLM. GLM has been designed following
|
||||
the idea that everyone does its own math library with his own conventions. The idea is that
|
||||
A common feature of shader languages like GLSL is components swizzling. This involves being able to select which components of a vector are used and in what order. For example, “variable.x”, “variable.xxy”, “variable.zxyy” are examples of swizzling.
|
||||
|
||||
\code
|
||||
vec4 A;
|
||||
vec2 B;
|
||||
...
|
||||
B.yx = A.wy;
|
||||
B = A.xx;
|
||||
\endcode
|
||||
|
||||
This functionally turns out to be really complicated, not to say impossible, to implement in C++ using the exact GLSL conventions. GLM provides 2 implementions this feature.
|
||||
|
||||
\subsection advanced_swizzle_macro Macro implementation
|
||||
|
||||
The first implementation follows the GLSL convensions accurately however it uses macros which might generates name conflicts with system headers or third party libraries so that it is disabled by default. To enable this implementation, GLM_SWIZZLE has to be defined before any inclusion of <glm/glm.hpp>.
|
||||
|
||||
\code
|
||||
#define GLM_SWIZZLE
|
||||
#include <glm/glm.hpp>
|
||||
\endcode
|
||||
|
||||
This implementation can be partially enabled by defining GLM_SWIZZLE_XYZW, GLM_SWIZZLE_RGBA or GLM_SWIZZLE_STQP. Each macro only enable a set of swizzling operators. For example we can only enable x,y,z,w and s,t,q,p operators using:
|
||||
|
||||
\code
|
||||
#define GLM_SWIZZLE_XYZW
|
||||
#define GLM_SWIZZLE_STQP
|
||||
#include <glm/glm.hpp>
|
||||
\endcode
|
||||
|
||||
\subsection advanced_swizzle_ext Extension implementation
|
||||
|
||||
A safer way to do swizzling is to use the extension GLM_GTC_swizzle. In term of functionalities, this extension is at the same level than GLSL expect that GLM support both static and dynamic swizzling where GLSL only support static swizzling.
|
||||
|
||||
Static swizzling is an operation which is resolved at build time but dynamic swizzling is revolved at runtime which is more flexible but slower especially when SSE instructions are used.
|
||||
|
||||
\code
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/swizzle.hpp>
|
||||
|
||||
void foo()
|
||||
{
|
||||
glm::vec4 ColorRGBA(1.0f, 0.5f, 0.0f, 1.0f);
|
||||
…
|
||||
// Dynamic swizzling (at run time, more flexible)
|
||||
// l-value:
|
||||
glm::vec4 ColorBGRA1 =
|
||||
glm::swizzle(ColorRGBA, glm::B, glm::G, glm::R, glm::A);
|
||||
// r-value:
|
||||
glm::swizzle(ColorRGBA, glm::B, glm::G, glm::R, glm::A) = ColorRGBA;
|
||||
|
||||
// Static swizzling (at build time, faster)
|
||||
// l-value:
|
||||
glm::vec4 ColorBGRA2 =
|
||||
glm::swizzle<glm::B, glm::G, glm::R, glm::A>(ColorRGBA);
|
||||
// r-value:
|
||||
glm::swizzle<glm::B, glm::G, glm::R, glm::A>(ColorRGBA) = ColorRGBA;
|
||||
}
|
||||
\endcode
|
||||
|
||||
\section advanced_notify Notification System
|
||||
|
||||
GLM includes a notification system which can display some information at build time:
|
||||
\li Compiler
|
||||
\li Build model: 32bits or 64 bits
|
||||
\li C++ version
|
||||
\li Architecture: x86, SSE, AVX, etc.
|
||||
\li Included extensions
|
||||
\li etc.
|
||||
|
||||
This system is disable by default. To enable this system, define GLM_MESSAGES before any inclusion of <glm/glm.hpp>.
|
||||
|
||||
\code
|
||||
#define GLM_MESSAGES
|
||||
#include <glm/glm.hpp>
|
||||
\endcode
|
||||
|
||||
\section advanced_inline Force Inline
|
||||
|
||||
To push further the software performance, a programmer can define GLM_FORCE_INLINE before any inclusion of <glm/glm.hpp> to force the compiler to inline GLM code.
|
||||
|
||||
\code
|
||||
#define GLM_FORCE_INLINE
|
||||
#include <glm/glm.hpp>
|
||||
\endcode
|
||||
|
||||
\section advanced_simd SIMD Support
|
||||
|
||||
GLM provides some SIMD optimizations based on compiler intrinsics. These optimizations will be automatically utilized based on the build environment. These optimizations are mainly available through extensions, \ref gtx_simd_vec4 and \ref gtx_simd_mat4.
|
||||
|
||||
A programmer can restrict or force instruction sets used for these optimizations using GLM_FORCE_SSE2 or GLM_FORCE_AVX.
|
||||
|
||||
A programmer can discard the use of intrinsics by defining GLM_FORCE_PURE before any inclusion of <glm/glm.hpp>. If GLM_FORCE_PURE is defined, then including a SIMD extension will generate a build error.
|
||||
|
||||
\code
|
||||
#define GLM_FORCE_PURE
|
||||
#include <glm/glm.hpp>
|
||||
\endcode
|
||||
|
||||
\section advanced_compatibility Compatibility
|
||||
Compilers have some language extensions that GLM will automatically take advantage of them when they are enabled. To increase cross platform compatibility and to avoid compiler extensions, a programmer can define GLM_FORCE_CXX98 before any inclusion of <glm/glm.hpp>.
|
||||
|
||||
\code
|
||||
#define GLM_FORCE_CXX98
|
||||
#include <glm/glm.hpp>
|
||||
\endcode
|
||||
**/
|
||||
|
||||
/*!
|
||||
\page pg_deprecated Deprecated Function Replacements
|
||||
|
||||
The OpenGL 3.0 specification deprecated some features, and most of these have been removed from the OpenGL 3.1 specfication and beyond. GLM provides some replacement functions.
|
||||
|
||||
\section deprecated_opengl OpenGL Function Replacements
|
||||
|
||||
<b>glRotate{f,d}:</b>
|
||||
|
||||
From \ref gtc_matrix_transform.
|
||||
|
||||
\code
|
||||
glm::mat4 glm::rotate(
|
||||
glm::mat4 const & m,
|
||||
float angle, glm::vec3 const & axis);
|
||||
glm::dmat4 glm::rotate(
|
||||
glm::dmat4 const & m,
|
||||
double angle, glm::dvec3 const & axis);
|
||||
\endcode
|
||||
|
||||
<b>glScale{f, d}:</b>
|
||||
|
||||
From \ref gtc_matrix_transform.
|
||||
|
||||
\code
|
||||
glm::mat4 glm::scale(
|
||||
glm::mat4 const & m,
|
||||
glm::vec3 const & factors);
|
||||
glm::dmat4 glm::scale(
|
||||
glm::dmat4 const & m,
|
||||
glm::dvec3 const & factors);
|
||||
\endcode
|
||||
|
||||
<b>glTranslate{f, d}:</b>
|
||||
|
||||
From \ref gtc_matrix_transform.
|
||||
|
||||
\code
|
||||
glm::mat4 glm::translate(
|
||||
glm::mat4 const & m,
|
||||
glm::vec3 const & translation);
|
||||
glm::dmat4 glm::translate(
|
||||
glm::dmat4 const & m,
|
||||
glm::dvec3 const & translation);
|
||||
\endcode
|
||||
|
||||
<b>glLoadIdentity:</b>
|
||||
|
||||
From \ref core.
|
||||
|
||||
\code
|
||||
glm::mat4(1.0) or glm::mat4();
|
||||
glm::dmat4(1.0) or glm::dmat4();
|
||||
\endcode
|
||||
|
||||
|
||||
<b>glMultMatrix{f, d}:</b>
|
||||
|
||||
From \ref core.
|
||||
|
||||
\code
|
||||
glm::mat4() * glm::mat4();
|
||||
glm::dmat4() * glm::dmat4();
|
||||
\endcode
|
||||
|
||||
<b>glLoadTransposeMatrix{f, d}:</b>
|
||||
|
||||
From \ref core.
|
||||
|
||||
\code
|
||||
glm::transpose(glm::mat4());
|
||||
glm::transpose(glm::dmat4());
|
||||
\endcode
|
||||
|
||||
<b>glMultTransposeMatrix{f, d}:</b>
|
||||
|
||||
From \ref core.
|
||||
|
||||
\code
|
||||
glm::mat4() * glm::transpose(glm::mat4());
|
||||
glm::dmat4() * glm::transpose(glm::dmat4());
|
||||
\endcode
|
||||
|
||||
<b>glFrustum:</b>
|
||||
|
||||
From \ref gtc_matrix_transform.
|
||||
|
||||
\code
|
||||
glm::mat4 glm::frustum(
|
||||
float left, float right,
|
||||
float bottom, float top,
|
||||
float zNear, float zFar);
|
||||
glm::dmat4 glm::frustum(
|
||||
double left, double right,
|
||||
double bottom, double top,
|
||||
double zNear, double zFar);
|
||||
\endcode
|
||||
|
||||
<b>glOrtho:</b>
|
||||
|
||||
From \ref gtc_matrix_transform.
|
||||
|
||||
\code
|
||||
glm::mat4 glm::ortho(
|
||||
float left, float right,
|
||||
float bottom, float top,
|
||||
float zNear, float zFar);
|
||||
glm::dmat4 glm::ortho(
|
||||
double left, double right,
|
||||
double bottom, double top,
|
||||
double zNear, double zFar);
|
||||
\endcode
|
||||
|
||||
\section deprecated_glu GLU Function Replacements
|
||||
|
||||
<b>gluLookAt:</b>
|
||||
|
||||
From \ref gtc_matrix_transform.
|
||||
|
||||
\code
|
||||
glm::mat4 glm::lookAt(
|
||||
glm::vec3 const & eye,
|
||||
glm::vec3 const & center,
|
||||
glm::vec3 const & up);
|
||||
glm::dmat4 glm::lookAt(
|
||||
glm::dvec3 const & eye,
|
||||
glm::dvec3 const & center,
|
||||
glm::dvec3 const & up);
|
||||
\endcode
|
||||
|
||||
<b>gluOrtho2D:</b>
|
||||
|
||||
From \ref gtc_matrix_transform.
|
||||
|
||||
\code
|
||||
glm::mat4 glm::ortho(
|
||||
float left, float right, float bottom, float top);
|
||||
glm::dmat4 glm::ortho(
|
||||
double left, double right, double bottom, double top);
|
||||
\endcode
|
||||
|
||||
<b>gluPerspective:</b>
|
||||
|
||||
From \ref gtc_matrix_transform.
|
||||
|
||||
\code
|
||||
glm::mat4 perspective(
|
||||
float fovy, float aspect, float zNear, float zFar);
|
||||
glm::dmat4 perspective(
|
||||
double fovy, double aspect, double zNear, double zFar);
|
||||
\endcode
|
||||
|
||||
<b>gluProject:</b>
|
||||
|
||||
From \ref gtc_matrix_transform.
|
||||
|
||||
\code
|
||||
glm::vec3 project(
|
||||
glm::vec3 const & obj,
|
||||
glm::mat4 const & model,
|
||||
glm::mat4 const & proj,
|
||||
glm::{i, ' ', d}vec4 const & viewport);
|
||||
glm::dvec3 project(
|
||||
glm::dvec3 const & obj,
|
||||
glm::dmat4 const & model,
|
||||
glm::dmat4 const & proj,
|
||||
glm::{i, ' ', d}vec4 const & viewport);
|
||||
\endcode
|
||||
|
||||
<b>gluUnProject:</b>
|
||||
|
||||
From \ref gtc_matrix_transform.
|
||||
|
||||
\code
|
||||
glm::vec3 unProject(
|
||||
glm::vec3 const & win,
|
||||
glm::mat4 const & model,
|
||||
glm::mat4 const & proj,
|
||||
glm::{i, ' '}vec4 const & viewport);
|
||||
glm::dvec3 unProject(
|
||||
glm::dvec3 const & win,
|
||||
glm::dmat4 const & model,
|
||||
glm::dmat4 const & proj,
|
||||
glm::{i, ' ', d}vec4 const & viewport);
|
||||
\endcode
|
||||
**/
|
||||
|
||||
/*!
|
||||
\page pg_differences Differences between GLSL and GLM core
|
||||
|
||||
GLM comes very close to replicating GLSL, but it is not exact. Here is a list of
|
||||
differences between GLM and GLSL:
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
Precision qualifiers. In GLSL numeric types can have qualifiers that define
|
||||
the precision of that type. While OpenGL's GLSL ignores these qualifiers, OpenGL
|
||||
ES's version of GLSL uses them.
|
||||
|
||||
C++ has no language equivalent to precision qualifiers. Instead, GLM provides
|
||||
a set of typedefs for each kind of precision qualifier and type. These types can
|
||||
be found in \ref core_precision "their own section".
|
||||
|
||||
Functions that take types tend to be templated on those types, so they can
|
||||
take these qualified types just as well as the regular ones.
|
||||
</li>
|
||||
</ul>
|
||||
**/
|
||||
|
||||
/*!
|
||||
\page pg_faq FAQ
|
||||
|
||||
\section faq1 Why does GLM follow GLSL specification and conventions?
|
||||
|
||||
Following GLSL conventions is a really strict policy of GLM. GLM has been designed according to
|
||||
the idea that everyone writes their own math library with their own conventions. The idea is that
|
||||
brilliant developers (the OpenGL ARB) worked together and agreed to make GLSL. Following
|
||||
GLSL conventions is a way to find consensus. Moreover, basically when a developer knows
|
||||
GLSL, he knows GLM.
|
||||
|
||||
\section faq2 Would it be possible to add my feature?
|
||||
|
||||
YES. Every feature request could be added by submitting it here:
|
||||
https://sourceforge.net/apps/trac/ogl-math/newticket
|
||||
|
||||
These requests would mainly take the form of extensions and if you provide an
|
||||
implementation, the feature will be added automatically in the next GLM release.
|
||||
|
||||
A SourceForge.net account is required to create a ticket.
|
||||
|
||||
\section faq3 Does GLM run GLSL program?
|
||||
\section faq2 Does GLM run GLSL program?
|
||||
|
||||
No, GLM is a C++ implementation of a subset of GLSL.
|
||||
|
||||
\section faq4 Does a GLSL compiler build GLM codes?
|
||||
\section faq3 Does a GLSL compiler build GLM codes?
|
||||
|
||||
Not directly but it can be easy to port. However, the difference between a shader and C++
|
||||
program at software design level will probably make this idea unlikely or impossible.
|
||||
No, this is not what GLM intends to do!
|
||||
|
||||
\section faq5 Should I use GTX extensions?
|
||||
\section faq4 Should I use GTX extensions?
|
||||
|
||||
GTX extensions are qualified to be experimental extensions. In GLM this means that these
|
||||
\ref gtx are qualified to be experimental extensions. In GLM this means that these
|
||||
extensions might change from version to version without restriction. In practice, it doesn't
|
||||
really change except time to time. GTC extensions are stabled, tested and perfectly reliable
|
||||
in time. Many GTX extensions extend GTC extensions and provide a way to explore features
|
||||
and implementations before becoming stable by a promotion as GTC extensions. This is
|
||||
fairly the way OpenGL features are developed through extensions.
|
||||
|
||||
\section faq6 Would it be possible to change GLM to do glVertex3fv(glm::vec3(0))?
|
||||
|
||||
It's possible to implement such thing in C++ with the implementation of the appropriate cast
|
||||
operator. In this example it's likely because it would result as a transparent cast, however,
|
||||
most of the time it's really unlikely resulting of build with no error and programs running
|
||||
with unexpected behaviors.
|
||||
|
||||
GLM_GTC_type_ptr extension provide a safe solution:
|
||||
|
||||
\code
|
||||
glm::vec4 v(0);
|
||||
glm::mat4 m(0);
|
||||
|
||||
glVertex3fv(glm::value_ptr(v))
|
||||
glLoadMatrixfv(glm::value_ptr(m));
|
||||
\endcode
|
||||
|
||||
Another solution inspired by STL:
|
||||
|
||||
\code
|
||||
glVertex3fv(&v[0]);
|
||||
glLoadMatrixfv(&m[0][0]);
|
||||
\endcode
|
||||
|
||||
\section faq7 Where can I ask my questions?
|
||||
\section faq5 Where can I ask my questions?
|
||||
|
||||
A good place is the OpenGL Toolkits forum on OpenGL.org:
|
||||
http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=postlist&Board=10&page=1
|
||||
|
||||
\section faq8 Where can I report a bug?
|
||||
|
||||
Just like feature requests:
|
||||
https://sourceforge.net/apps/trac/ogl-math/newticket
|
||||
|
||||
A SourceForge account is required to create a ticket.
|
||||
|
||||
\section faq8 Where can I find the documentation of extensions?
|
||||
\section faq6 Where can I find the documentation of extensions?
|
||||
|
||||
The Doxygen generated documentation includes a complete list of all extensions available.
|
||||
Explore this documentation to get a complete view of all GLM capabilities!
|
||||
http://glm.g-truc.net/html/index.html
|
||||
|
||||
\section faq9 Should I use 'using namespace glm;'?
|
||||
\section faq7 Should I use 'using namespace glm;'?
|
||||
|
||||
NO! Chances are that if 'using namespace glm;' is called, name collisions will happen
|
||||
because GLM is based on GLSL and GLSL is also a consensus on tokens so these tokens are
|
||||
probably used quite often.
|
||||
|
||||
If you need frequent use of certain types, you can bring them into the global
|
||||
namespace with a using declaration like this:
|
||||
|
||||
/code
|
||||
using glm::mat4;
|
||||
|
||||
mat4 someVariable(3.0f);
|
||||
/endcode
|
||||
|
||||
\section faq8 Is GLM fast?
|
||||
|
||||
First, GLM is mainly designed to be convenient and that's why it is written against GLSL specification. Following the 20-80 rules where 20% of the code grad 80% of the performances, GLM perfectly operates on the 80% of the code that consumes 20% of the performances. This said, on performance critical code section, the developers will probably have to write to specific code based on a specific design to reach peak performances but GLM can provides some descent performances alternatives based on approximations or SIMD instructions.
|
||||
**/
|
||||
|
||||
/**
|
||||
\page issues Known Issues
|
||||
/*!
|
||||
\page pg_samples Code Samples
|
||||
|
||||
\section issue1 Swizzle Operators
|
||||
This series of samples only shows various GLM functionalities without consideration of any sort.
|
||||
|
||||
\section sample1 Compute a Triangle's Normal
|
||||
|
||||
Enabling the swizzle operator can result in name collisions with the Win32 API.
|
||||
Consequently swizzle operators are disable by default. A safer way to do swizzling is to use
|
||||
the member function 'swizzle'. Future version of GLM should remove this limitation.
|
||||
\code
|
||||
#include <glm/glm.hpp> // vec3 normalize cross
|
||||
|
||||
glm::vec3 computeNormal(
|
||||
glm::vec3 const & a,
|
||||
glm::vec3 const & b,
|
||||
glm::vec3 const & c)
|
||||
{
|
||||
return glm::normalize(glm::cross(c - a, b - a));
|
||||
}
|
||||
\endcode
|
||||
|
||||
A potentially faster, but less accurate alternative:
|
||||
|
||||
\section issue2 not Function
|
||||
\code
|
||||
#include <glm/glm.hpp> // vec3 cross
|
||||
#include <glm/gtx/fast_square_root.hpp> // fastNormalize
|
||||
|
||||
glm::vec3 computeNormal(
|
||||
glm::vec3 const & a,
|
||||
glm::vec3 const & b,
|
||||
glm::vec3 const & c)
|
||||
{
|
||||
return glm::fastNormalize(glm::cross(c - a, b - a));
|
||||
}
|
||||
\endcode
|
||||
|
||||
\section sample2 Matrix Transform
|
||||
|
||||
\code
|
||||
#include <glm/glm.hpp> //vec3, vec4, ivec4, mat4
|
||||
#include <glm/gtc/matrix_transform.hpp> //translate, rotate, scale, perspective
|
||||
#include <glm/gtc/type_ptr.hpp> //value_ptr
|
||||
|
||||
void setUniformMVP(
|
||||
GLuint Location,
|
||||
glm::vec3 const & Translate,
|
||||
glm::vec3 const & Rotate)
|
||||
{
|
||||
glm::mat4 Projection =
|
||||
glm::perspective(45.0f, 4.0f / 3.0f, 0.1f, 100.f);
|
||||
glm::mat4 ViewTranslate = glm::translate(
|
||||
glm::mat4(1.0f),
|
||||
Translate);
|
||||
glm::mat4 ViewRotateX = glm::rotate(
|
||||
ViewTranslate,
|
||||
Rotate.y, glm::vec3(-1.0f, 0.0f, 0.0f));
|
||||
glm::mat4 View = glm::rotate(
|
||||
ViewRotateX,
|
||||
Rotate.x, glm::vec3(0.0f, 1.0f, 0.0f));
|
||||
glm::mat4 Model = glm::scale(
|
||||
glm::mat4(1.0f),
|
||||
glm::vec3(0.5f));
|
||||
glm::mat4 MVP = Projection * View * Model;
|
||||
glUniformMatrix4fv(
|
||||
Location, 1, GL_FALSE, glm::value_ptr(MVP));
|
||||
}
|
||||
\endcode
|
||||
|
||||
\section sample3 Vector Types
|
||||
|
||||
\code
|
||||
#include <glm/glm.hpp> //vec2
|
||||
#include <glm/gtc/type_precision.hpp> //hvec2, i8vec2, i32vec2
|
||||
std::size_t const VertexCount = 4;
|
||||
|
||||
// Float quad geometry
|
||||
std::size_t const PositionSizeF32 = VertexCount * sizeof(glm::vec2);
|
||||
glm::vec2 const PositionDataF32[VertexCount] =
|
||||
{
|
||||
glm::vec2(-1.0f,-1.0f),
|
||||
glm::vec2( 1.0f,-1.0f),
|
||||
glm::vec2( 1.0f, 1.0f),
|
||||
glm::vec2(-1.0f, 1.0f)
|
||||
};
|
||||
|
||||
// Half-float quad geometry
|
||||
std::size_t const PositionSizeF16 = VertexCount * sizeof(glm::hvec2);
|
||||
glm::hvec2 const PositionDataF16[VertexCount] =
|
||||
{
|
||||
glm::hvec2(-1.0f, -1.0f),
|
||||
glm::hvec2( 1.0f, -1.0f),
|
||||
glm::hvec2( 1.0f, 1.0f),
|
||||
glm::hvec2(-1.0f, 1.0f)
|
||||
};
|
||||
|
||||
// 8 bits signed integer quad geometry
|
||||
std::size_t const PositionSizeI8 = VertexCount * sizeof(glm::i8vec2);
|
||||
glm::i8vec2 const PositionDataI8[VertexCount] =
|
||||
{
|
||||
glm::i8vec2(-1,-1),
|
||||
glm::i8vec2( 1,-1),
|
||||
glm::i8vec2( 1, 1),
|
||||
glm::i8vec2(-1, 1)
|
||||
};
|
||||
|
||||
// 32 bits signed integer quad geometry
|
||||
std::size_t const PositionSizeI32 = VertexCount * sizeof(glm::i32vec2);
|
||||
glm::i32vec2 const PositionDataI32[VertexCount] =
|
||||
{
|
||||
glm::i32vec2 (-1,-1),
|
||||
glm::i32vec2 ( 1,-1),
|
||||
glm::i32vec2 ( 1, 1),
|
||||
glm::i32vec2 (-1, 1)
|
||||
};
|
||||
\endcode
|
||||
|
||||
\section sample4 Lighting
|
||||
|
||||
\code
|
||||
#include <glm/glm.hpp> // vec3 normalize reflect dot pow
|
||||
#include <glm/gtx/random.hpp> // vecRand3
|
||||
|
||||
// vecRand3, generate a random and equiprobable normalized vec3
|
||||
|
||||
glm::vec3 lighting(
|
||||
intersection const & Intersection,
|
||||
material const & Material,
|
||||
light const & Light,
|
||||
glm::vec3 const & View)
|
||||
{
|
||||
glm::vec3 Color = glm::vec3(0.0f);
|
||||
glm::vec3 LightVertor = glm::normalize(
|
||||
Light.position() - Intersection.globalPosition() +
|
||||
glm::vecRand3(0.0f, Light.inaccuracy());
|
||||
|
||||
if(!shadow(
|
||||
Intersection.globalPosition(),
|
||||
Light.position(),
|
||||
LightVertor))
|
||||
{
|
||||
float Diffuse = glm::dot(Intersection.normal(), LightVector);
|
||||
if(Diffuse <= 0.0f)
|
||||
return Color;
|
||||
if(Material.isDiffuse())
|
||||
Color += Light.color() * Material.diffuse() * Diffuse;
|
||||
|
||||
if(Material.isSpecular())
|
||||
{
|
||||
glm::vec3 Reflect = glm::reflect(
|
||||
-LightVector,
|
||||
Intersection.normal());
|
||||
float Dot = glm::dot(Reflect, View);
|
||||
float Base = Dot > 0.0f ? Dot : 0.0f;
|
||||
float Specular = glm::pow(Base, Material.exponent());
|
||||
Color += Material.specular() * Specular;
|
||||
}
|
||||
return Color;
|
||||
}
|
||||
\endcode
|
||||
|
||||
**/
|
||||
|
||||
/*!
|
||||
\page pg_issues Known Issues
|
||||
|
||||
\section issue1 not Function
|
||||
|
||||
The GLSL keyword not is also a keyword in C++. To prevent name collisions, the GLSL not
|
||||
function has been implemented with the name not_.
|
||||
|
||||
\section issue3 Half Based Types
|
||||
GLM supports half float number types through the extension GLM_GTC_half_float. This
|
||||
extension provides the types half, hvec*, hmat*x* and hquat*.
|
||||
\section issue2 Half Based Types
|
||||
GLM supports half float number types through the extension GLM_GTC_half_float. This extension provides the types half, hvec*, hmat*x* and hquat*.
|
||||
|
||||
Unfortunately, C++ norm doesn't support anonymous unions which limit hvec* vector
|
||||
components access to x, y, z and w.
|
||||
Unfortunately, C++ 98 specification doesn’t support anonymous unions which limit hvec* vector components access to x, y, z and w.
|
||||
|
||||
However, Visual C++ does support anonymous unions. When
|
||||
GLM_USE_ANONYMOUS_UNION is define, it enables the support of all component names
|
||||
(x,y,z,w ; r,g,b,a ; s,t,p,q). With GCC it will result in a build error.
|
||||
However, Visual C++ does support anonymous unions if the language extensions are enabled (/Za to disable them). In this case GLM will automatically enables the support of all component names (x,y,z,w ; r,g,b,a ; s,t,p,q).
|
||||
|
||||
To uniformalize the component access across types, GLM provides the define GLM_FORCE_ONLY_XYZW which will generates errors if component accesses are done using r,g,b,a or s,t,p,q.
|
||||
|
||||
\code
|
||||
#define GLM_FORCE_ONLY_XYZW
|
||||
#include <glm/glm.hpp>
|
||||
\endcode
|
||||
**/
|
||||
|
||||
/**
|
||||
\page reference References
|
||||
/*!
|
||||
\page pg_reference References
|
||||
|
||||
OpenGL 4.1 core specification:
|
||||
http://www.opengl.org/registry/doc/glspec41.core.20100725.pdf
|
||||
http://www.opengl.org/registry/doc/glspec41.core.20100725.pdf
|
||||
|
||||
GLSL 4.10 specification:
|
||||
http://www.opengl.org/registry/doc/GLSLangSpec.4.10.6.clean.pdf
|
||||
http://www.opengl.org/registry/doc/GLSLangSpec.4.10.6.clean.pdf
|
||||
|
||||
GLU 1.3 specification:
|
||||
http://www.opengl.org/documentation/specs/glu/glu1_3.pdf
|
||||
|
||||
GLM HEAD snapshot:
|
||||
http://ogl-math.git.sourceforge.net/git/gitweb.cgi?p=ogl-math/ogl-math;a=snapshot;h=HEAD;sf=tgz
|
||||
http://ogl-math.git.sourceforge.net/git/gitweb.cgi?p=ogl-math/ogl-math;a=snapshot;h=HEAD;sf=tgz
|
||||
|
||||
GLM Trac, for bug report and feature request:
|
||||
https://sourceforge.net/apps/trac/ogl-math
|
||||
@ -263,6 +706,9 @@ glLoadMatrixfv(&m[0][0]);
|
||||
http://glm.g-truc.net
|
||||
|
||||
G-Truc Creation page:
|
||||
http://www.g-truc.net/project-0016.html
|
||||
http://www.g-truc.net/project-0016.html
|
||||
|
||||
The OpenGL Toolkits forum to ask questions about GLM:
|
||||
http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=postlist&Board=10&page=1
|
||||
**/
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user