Defines | 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.

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 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 35 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); \
  }

Definition at line 46 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 59 of file openglsupport.cpp.


Function Documentation

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.

Definition at line 124 of file openglsupport.cpp.



re_vision
Author(s): Dorian Galvez-Lopez
autogenerated on Sun Jan 5 2014 11:33:46