#include <main.h>
#include <iostream>
#include <GL/glew.h>
#include <Eigen/OpenGLSupport>
#include <GL/glut.h>
Go to the source code of this file.
Defines | |
#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 () |
#define VERIFY_MATRIX | ( | CODE, | |
REF | |||
) |
{ \ 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 35 of file openglsupport.cpp.
#define VERIFY_UNIFORM | ( | SUFFIX, | |
NAME, | |||
TYPE | |||
) |
{ \ 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); \ }
Definition at line 46 of file openglsupport.cpp.
#define VERIFY_UNIFORMi | ( | NAME, | |
TYPE | |||
) |
{ \ 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 59 of file openglsupport.cpp.
GLint createShader | ( | const char * | vtx, |
const char * | frg | ||
) |
Definition at line 87 of file openglsupport.cpp.
void printInfoLog | ( | GLuint | objectID | ) |
Definition at line 72 of file openglsupport.cpp.
void test_openglsupport | ( | ) |
Definition at line 124 of file openglsupport.cpp.