Macros | Functions
openglsupport.cpp File Reference
#include <main.h>
#include <iostream>
#include <GL/glew.h>
#include <Eigen/OpenGLSupport>
#include <GL/glut.h>
Include dependency graph for openglsupport.cpp:

Go to the source code of this file.

Macros

#define VERIFY_MATRIX(CODE, REF)
 
#define VERIFY_UNIFORM(SUFFIX, NAME, TYPE)
 
#define VERIFY_UNIFORMi(NAME, TYPE)
 

Functions

GLint createShader (const char *vtx, const char *frg)
 
void printInfoLog (GLuint objectID)
 
void test_openglsupport ()
 

Macro Definition Documentation

#define VERIFY_MATRIX (   CODE,
  REF 
)
Value:
{ \
glLoadIdentity(); \
CODE; \
Matrix<float,4,4,ColMajor> m; m.setZero(); \
glGet(GL_MODELVIEW_MATRIX, m); \
if(!(REF).cast<float>().isApprox(m)) { \
std::cerr << "Expected:\n" << ((REF).cast<float>()) << "\n" << "got\n" << m << "\n\n"; \
} \
VERIFY_IS_APPROX((REF).cast<float>(), m); \
}

Definition at line 20 of file openglsupport.cpp.

#define VERIFY_UNIFORM (   SUFFIX,
  NAME,
  TYPE 
)
Value:
{ \
TYPE value; value.setRandom(); \
TYPE data; \
int loc = glGetUniformLocation(prg_id, #NAME); \
VERIFY((loc!=-1) && "uniform not found"); \
glUniform(loc,value); \
EIGEN_CAT(glGetUniform,SUFFIX)(prg_id,loc,data.data()); \
if(!value.isApprox(data)) { \
std::cerr << "Expected:\n" << value << "\n" << "got\n" << data << "\n\n"; \
} \
VERIFY_IS_APPROX(value, data); \
}
#define EIGEN_CAT(a, b)
Definition: Macros.h:479

Definition at line 31 of file openglsupport.cpp.

#define VERIFY_UNIFORMi (   NAME,
  TYPE 
)
Value:
{ \
TYPE value = TYPE::Random().eval().cast<float>().cast<TYPE::Scalar>(); \
TYPE data; \
int loc = glGetUniformLocation(prg_id, #NAME); \
VERIFY((loc!=-1) && "uniform not found"); \
glUniform(loc,value); \
glGetUniformiv(prg_id,loc,(GLint*)data.data()); \
if(!value.isApprox(data)) { \
std::cerr << "Expected:\n" << value << "\n" << "got\n" << data << "\n\n"; \
} \
VERIFY_IS_APPROX(value, data); \
}

Definition at line 44 of file openglsupport.cpp.

Function Documentation

GLint createShader ( const char *  vtx,
const char *  frg 
)

Definition at line 72 of file openglsupport.cpp.

void printInfoLog ( GLuint  objectID)

Definition at line 57 of file openglsupport.cpp.

void test_openglsupport ( )

Definition at line 109 of file openglsupport.cpp.



hebiros
Author(s): Xavier Artache , Matthew Tesch
autogenerated on Thu Sep 3 2020 04:09:50