10 #ifndef EIGEN_OPENGL_MODULE_H
11 #define EIGEN_OPENGL_MODULE_H
13 #include "../../Eigen/Geometry"
15 #if defined(__APPLE_CC__)
16 #include <OpenGL/gl.h>
48 #define EIGEN_GL_FUNC_DECLARATION(FUNC) \
49 namespace internal { \
50 template< typename XprType, \
51 typename Scalar = typename XprType::Scalar, \
52 int Rows = XprType::RowsAtCompileTime, \
53 int Cols = XprType::ColsAtCompileTime, \
54 bool IsGLCompatible = bool(internal::evaluator<XprType>::Flags&LinearAccessBit) \
55 && bool(XprType::Flags&DirectAccessBit) \
56 && (XprType::IsVectorAtCompileTime || (XprType::Flags&RowMajorBit)==0)> \
57 struct EIGEN_CAT(EIGEN_CAT(gl_,FUNC),_impl); \
59 template<typename XprType, typename Scalar, int Rows, int Cols> \
60 struct EIGEN_CAT(EIGEN_CAT(gl_,FUNC),_impl)<XprType,Scalar,Rows,Cols,false> { \
61 inline static void run(const XprType& p) { \
62 EIGEN_CAT(EIGEN_CAT(gl_,FUNC),_impl)<typename plain_matrix_type_column_major<XprType>::type>::run(p); } \
66 template<typename Derived> inline void FUNC(const Eigen::DenseBase<Derived>& p) { \
67 EIGEN_CAT(EIGEN_CAT(internal::gl_,FUNC),_impl)<Derived>::run(p.derived()); \
71 #define EIGEN_GL_FUNC_SPECIALIZATION_MAT(FUNC,SCALAR,ROWS,COLS,SUFFIX) \
72 namespace internal { \
73 template< typename XprType> struct EIGEN_CAT(EIGEN_CAT(gl_,FUNC),_impl)<XprType, SCALAR, ROWS, COLS, true> { \
74 inline static void run(const XprType& p) { FUNC##SUFFIX(p.data()); } \
79 #define EIGEN_GL_FUNC_SPECIALIZATION_VEC(FUNC,SCALAR,SIZE,SUFFIX) \
80 namespace internal { \
81 template< typename XprType> struct EIGEN_CAT(EIGEN_CAT(gl_,FUNC),_impl)<XprType, SCALAR, SIZE, 1, true> { \
82 inline static void run(const XprType& p) { FUNC##SUFFIX(p.data()); } \
84 template< typename XprType> struct EIGEN_CAT(EIGEN_CAT(gl_,FUNC),_impl)<XprType, SCALAR, 1, SIZE, true> { \
85 inline static void run(const XprType& p) { FUNC##SUFFIX(p.data()); } \
187 glRotated(rot.
angle()*180.0/
double(
EIGEN_PI), 0.0, 0.0, 1.0);
196 #define EIGEN_GL_MAKE_CONST_const const
197 #define EIGEN_GL_MAKE_CONST__
198 #define EIGEN_GL_EVAL(X) X
200 #define EIGEN_GL_FUNC1_DECLARATION(FUNC,ARG1,CONST) \
201 namespace internal { \
202 template< typename XprType, \
203 typename Scalar = typename XprType::Scalar, \
204 int Rows = XprType::RowsAtCompileTime, \
205 int Cols = XprType::ColsAtCompileTime, \
206 bool IsGLCompatible = bool(internal::evaluator<XprType>::Flags&LinearAccessBit) \
207 && bool(XprType::Flags&DirectAccessBit) \
208 && (XprType::IsVectorAtCompileTime || (XprType::Flags&RowMajorBit)==0)> \
209 struct EIGEN_CAT(EIGEN_CAT(gl_,FUNC),_impl); \
211 template<typename XprType, typename Scalar, int Rows, int Cols> \
212 struct EIGEN_CAT(EIGEN_CAT(gl_,FUNC),_impl)<XprType,Scalar,Rows,Cols,false> { \
213 inline static void run(ARG1 a,EIGEN_GL_EVAL(EIGEN_GL_MAKE_CONST_##CONST) XprType& p) { \
214 EIGEN_CAT(EIGEN_CAT(gl_,FUNC),_impl)<typename plain_matrix_type_column_major<XprType>::type>::run(a,p); } \
218 template<typename Derived> inline void FUNC(ARG1 a,EIGEN_GL_EVAL(EIGEN_GL_MAKE_CONST_##CONST) Eigen::DenseBase<Derived>& p) { \
219 EIGEN_CAT(EIGEN_CAT(internal::gl_,FUNC),_impl)<Derived>::run(a,p.derived()); \
223 #define EIGEN_GL_FUNC1_SPECIALIZATION_MAT(FUNC,ARG1,CONST,SCALAR,ROWS,COLS,SUFFIX) \
224 namespace internal { \
225 template< typename XprType> struct EIGEN_CAT(EIGEN_CAT(gl_,FUNC),_impl)<XprType, SCALAR, ROWS, COLS, true> { \
226 inline static void run(ARG1 a, EIGEN_GL_EVAL(EIGEN_GL_MAKE_CONST_##CONST) XprType& p) { FUNC##SUFFIX(a,p.data()); } \
231 #define EIGEN_GL_FUNC1_SPECIALIZATION_VEC(FUNC,ARG1,CONST,SCALAR,SIZE,SUFFIX) \
232 namespace internal { \
233 template< typename XprType> struct EIGEN_CAT(EIGEN_CAT(gl_,FUNC),_impl)<XprType, SCALAR, SIZE, 1, true> { \
234 inline static void run(ARG1 a, EIGEN_GL_EVAL(EIGEN_GL_MAKE_CONST_##CONST) XprType& p) { FUNC##SUFFIX(a,p.data()); } \
236 template< typename XprType> struct EIGEN_CAT(EIGEN_CAT(gl_,FUNC),_impl)<XprType, SCALAR, 1, SIZE, true> { \
237 inline static void run(ARG1 a, EIGEN_GL_EVAL(EIGEN_GL_MAKE_CONST_##CONST) XprType& p) { FUNC##SUFFIX(a,p.data()); } \
247 #ifdef GL_VERSION_2_0
249 inline void glUniform2fv_ei (GLint loc,
const float* v) { glUniform2fv(loc,1,
v); }
250 inline void glUniform2iv_ei (GLint loc,
const int* v) { glUniform2iv(loc,1,v); }
252 inline void glUniform3fv_ei (GLint loc,
const float* v) { glUniform3fv(loc,1,v); }
253 inline void glUniform3iv_ei (GLint loc,
const int* v) { glUniform3iv(loc,1,v); }
255 inline void glUniform4fv_ei (GLint loc,
const float* v) { glUniform4fv(loc,1,v); }
256 inline void glUniform4iv_ei (GLint loc,
const int* v) { glUniform4iv(loc,1,v); }
258 inline void glUniformMatrix2fv_ei (GLint loc,
const float* v) { glUniformMatrix2fv(loc,1,
false,v); }
259 inline void glUniformMatrix3fv_ei (GLint loc,
const float* v) { glUniformMatrix3fv(loc,1,
false,v); }
260 inline void glUniformMatrix4fv_ei (GLint loc,
const float* v) { glUniformMatrix4fv(loc,1,
false,v); }
277 #ifdef GL_VERSION_2_1
279 inline void glUniformMatrix2x3fv_ei(GLint loc,
const float* v) { glUniformMatrix2x3fv(loc,1,
false,v); }
280 inline void glUniformMatrix3x2fv_ei(GLint loc,
const float* v) { glUniformMatrix3x2fv(loc,1,
false,v); }
281 inline void glUniformMatrix2x4fv_ei(GLint loc,
const float* v) { glUniformMatrix2x4fv(loc,1,
false,v); }
282 inline void glUniformMatrix4x2fv_ei(GLint loc,
const float* v) { glUniformMatrix4x2fv(loc,1,
false,v); }
283 inline void glUniformMatrix3x4fv_ei(GLint loc,
const float* v) { glUniformMatrix3x4fv(loc,1,
false,v); }
284 inline void glUniformMatrix4x3fv_ei(GLint loc,
const float* v) { glUniformMatrix4x3fv(loc,1,
false,v); }
295 #ifdef GL_VERSION_3_0
297 inline void glUniform2uiv_ei (GLint loc,
const unsigned int* v) { glUniform2uiv(loc,1,v); }
298 inline void glUniform3uiv_ei (GLint loc,
const unsigned int* v) { glUniform3uiv(loc,1,v); }
299 inline void glUniform4uiv_ei (GLint loc,
const unsigned int* v) { glUniform4uiv(loc,1,v); }
307 #ifdef GL_ARB_gpu_shader_fp64
308 inline void glUniform2dv_ei (GLint loc,
const double* v) { glUniform2dv(loc,1,v); }
309 inline void glUniform3dv_ei (GLint loc,
const double* v) { glUniform3dv(loc,1,v); }
310 inline void glUniform4dv_ei (GLint loc,
const double* v) { glUniform4dv(loc,1,v); }
Array< int, Dynamic, 1 > v
#define EIGEN_GL_FUNC1_SPECIALIZATION_MAT(FUNC, ARG1, CONST, SCALAR, ROWS, COLS, SUFFIX)
#define EIGEN_GL_FUNC1_SPECIALIZATION_VEC(FUNC, ARG1, CONST, SCALAR, SIZE, SUFFIX)
#define EIGEN_GL_FUNC_SPECIALIZATION_MAT(FUNC, SCALAR, ROWS, COLS, SUFFIX)
#define EIGEN_GL_FUNC_DECLARATION(FUNC)
#define EIGEN_GL_FUNC1_DECLARATION(FUNC, ARG1, CONST)
#define EIGEN_GL_FUNC_SPECIALIZATION_VEC(FUNC, SCALAR, SIZE, SUFFIX)
: TensorContractionSycl.h, provides various tensor contraction kernel for SYCL backend
void glScale2dv(const double *v)
void glLoadMatrix(const Transform< Scalar, 3, Affine > &t)
void glRotate(const Rotation2D< float > &rot)
void glTranslate2dv(const double *v)
void glTranslate3dv(const double *v)
void glScale2fv(const float *v)
void glTranslate3fv(const float *v)
void glScale3fv(const float *v)
void glTranslate(const Translation< Scalar, 2 > &t)
void glTranslate2fv(const float *v)
void glScale(const UniformScaling< Scalar > &s)
void glMultMatrix(const Transform< Scalar, 3, Affine > &t)
void glScale3dv(const double *v)