Macros | Functions
openglsupport.cpp File Reference
#include <main.h>
#include <iostream>
#include <string>
#include <GL/glew.h>
#include <Eigen/OpenGLSupport>
#include <GL/freeglut.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 createProgram (const char *vtx, const char *frg, bool print_errors=true)
 
GLint createProgram (const std::string &vtx, const std::string &frg, bool print_errors=true)
 
 EIGEN_DECLARE_TEST (openglsupport)
 
void find_and_replace (std::string &str, const std::string &find, const std::string &replace)
 
std::string format (const std::string &str, const std::vector< std::string > &find, const std::vector< std::string > &replace)
 
std::string getGlslVersionString (int gl_major_version, int gl_minor_version)
 
void openglsupport_test_loop ()
 
void printProgramInfoLog (GLuint objectID)
 
void printShaderInfoLog (GLuint objectID)
 

Macro Definition Documentation

◆ VERIFY_MATRIX

#define VERIFY_MATRIX (   CODE,
  REF 
)
Value:
{ \
glMatrixMode(GL_MODELVIEW); \
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 28 of file openglsupport.cpp.

◆ VERIFY_UNIFORM

#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 40 of file openglsupport.cpp.

◆ VERIFY_UNIFORMi

#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 53 of file openglsupport.cpp.

Function Documentation

◆ createProgram() [1/2]

GLint createProgram ( const char *  vtx,
const char *  frg,
bool  print_errors = true 
)

Definition at line 96 of file openglsupport.cpp.

◆ createProgram() [2/2]

GLint createProgram ( const std::string &  vtx,
const std::string &  frg,
bool  print_errors = true 
)

Definition at line 157 of file openglsupport.cpp.

◆ EIGEN_DECLARE_TEST()

EIGEN_DECLARE_TEST ( openglsupport  )

Definition at line 559 of file openglsupport.cpp.

◆ find_and_replace()

void find_and_replace ( std::string &  str,
const std::string &  find,
const std::string &  replace 
)

Definition at line 211 of file openglsupport.cpp.

◆ format()

std::string format ( const std::string &  str,
const std::vector< std::string > &  find,
const std::vector< std::string > &  replace 
)

Definition at line 226 of file openglsupport.cpp.

◆ getGlslVersionString()

std::string getGlslVersionString ( int  gl_major_version,
int  gl_minor_version 
)

Definition at line 162 of file openglsupport.cpp.

◆ openglsupport_test_loop()

void openglsupport_test_loop ( )

Definition at line 240 of file openglsupport.cpp.

◆ printProgramInfoLog()

void printProgramInfoLog ( GLuint  objectID)

Definition at line 66 of file openglsupport.cpp.

◆ printShaderInfoLog()

void printShaderInfoLog ( GLuint  objectID)

Definition at line 81 of file openglsupport.cpp.

conf.loc
loc
Definition: wrap/pybind11/docs/conf.py:74
Eigen::internal::isApprox
EIGEN_DEVICE_FUNC bool isApprox(const Scalar &x, const Scalar &y, const typename NumTraits< Scalar >::Real &precision=NumTraits< Scalar >::dummy_precision())
Definition: Eigen/src/Core/MathFunctions.h:1947
gtwrap.interface_parser.tokens.REF
REF
Definition: tokens.py:21
data
int data[]
Definition: Map_placement_new.cpp:1
m
Matrix3f m
Definition: AngleAxis_mimic_euler.cpp:1
test_callbacks.value
value
Definition: test_callbacks.py:160


gtsam
Author(s):
autogenerated on Fri Nov 1 2024 03:43:20