libigl v2.5.0
|
Namespaces | |
namespace | glfw |
namespace | stb |
Classes | |
struct | gliGenericImage |
class | MeshGL |
Coverts mesh data inside a igl::ViewerData class in an OpenGL compatible format The class includes a shader and the opengl calls to plot the data. More... | |
struct | TgaFooter |
struct | TgaHeader |
class | ViewerCore |
Basic class of the 3D mesh viewer. More... | |
class | ViewerData |
Object being drawn (i.e., mesh and its accessories) by the ViewerCore. More... | |
Functions | |
bool | render_to_tga (const std::string tga_file, const int width, const int height, const bool alpha) |
alpha whether to include alpha channel | |
bool | texture_from_tga (const std::string tga_file, GLuint &id) |
Read an image from a .tga file and use it as a texture. | |
gliGenericImage * | gliReadTGA (FILE *fp, char *name, int hflip, int vflip) |
int | gli_verbose (int new_verbose) |
int | gliVerbose (int newVerbose) |
void | writeTGA (gliGenericImage *image, FILE *fp) |
template<typename Scalar , int RowsAtCompileTime, int ColsAtCompileTime> | |
GLint | bind_vertex_attrib_array (const GLuint program_shader, const std::string &name, GLuint bufferID, const Eigen::Matrix< Scalar, RowsAtCompileTime, ColsAtCompileTime, Eigen::RowMajor > &M, const bool refresh) |
Bind a per-vertex array attribute and refresh its contents from an Eigen matrix. | |
void | create_index_vbo (const Eigen::MatrixXi &F, GLuint &F_vbo_id) |
Create a VBO (Vertex Buffer Object) for a list of indices: GL_ELEMENT_ARRAY_BUFFER_ARB for the triangle indices (F) | |
void | create_mesh_vbo (const Eigen::MatrixXd &V, const Eigen::MatrixXi &F, GLuint &V_vbo_id, GLuint &F_vbo_id) |
Create a VBO (Vertex Buffer Object) for a mesh. | |
void | create_mesh_vbo (const Eigen::MatrixXd &V, const Eigen::MatrixXi &F, const Eigen::MatrixXd &N, GLuint &V_vbo_id, GLuint &F_vbo_id, GLuint &N_vbo_id) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
bool | create_shader_program (const std::string &geom_source, const std::string &vert_source, const std::string &frag_source, const std::map< std::string, GLuint > &attrib, GLuint &id) |
Create a shader program with a vertex and fragments shader loading from source strings and vertex attributes assigned from a map before linking the shaders to the program, making it ready to use with glUseProgram(id) | |
bool | create_shader_program (const std::string &vert_source, const std::string &frag_source, const std::map< std::string, GLuint > &attrib, GLuint &id) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
GLuint | create_shader_program (const std::string &geom_source, const std::string &vert_source, const std::string &frag_source, const std::map< std::string, GLuint > &attrib) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
GLuint | create_shader_program (const std::string &vert_source, const std::string &frag_source, const std::map< std::string, GLuint > &attrib) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
template<typename T > | |
void | create_vector_vbo (const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &V, GLuint &V_vbo_id) |
Create a VBO (Vertex Buffer Object) for a list of vectors: GL_ARRAY_BUFFER for the vectors (V) | |
bool | destroy_shader_program (const GLuint id) |
Properly destroy a shader program. | |
int | gl_type_size (const GLenum type) |
Return the number of bytes for a given OpenGL type. | |
void | init_render_to_texture (const size_t width, const size_t height, const bool depth_texture, GLuint &tex_id, GLuint &fbo_id, GLuint &d_id) |
Create a frame buffer that renders color to a RGBA texture a depth to a "render buffer". | |
void | init_render_to_texture (const size_t width, const size_t height, GLuint &tex_id, GLuint &fbo_id, GLuint &dfbo_id) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
GLuint | load_shader (const std::string &src, const GLenum type) |
Creates and compiles a shader from a given string. | |
void | print_program_info_log (const GLuint obj) |
Print the information log for a program object. | |
void | print_shader_info_log (const GLuint obj) |
Print the info log for a shader object. | |
template<typename T > | |
void | read_pixels (const GLuint width, const GLuint height, Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &R, Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &G, Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &B, Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &A, Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &D) |
Read full viewport into color, alpha and depth arrays suitable for igl::png::writePNG. | |
GLenum | report_gl_error (const std::string id) |
Print last OpenGL error to stderr prefixed by specified id string. | |
GLenum | report_gl_error () |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
std::string | uniform_type_to_string (const GLenum type) |
Convert a GL uniform variable type (say, returned from glGetActiveUniform) and output a string naming that type. | |
void | decompress_verasansmono_atlas (unsigned char *_fontatlas) |
Decompress the vera sans mono font atlas. | |
template<typename DerivedV , typename DerivedF > | |
void | vertex_array (const Eigen::PlainObjectBase< DerivedV > &V, const Eigen::PlainObjectBase< DerivedF > &F, GLuint &va_id, GLuint &ab_id, GLuint &eab_id) |
Create a GL_VERTEX_ARRAY for a given mesh (V,F) | |
bool igl::opengl::render_to_tga | ( | const std::string | tga_file, |
const int | width, | ||
const int | height, | ||
const bool | alpha | ||
) |
alpha whether to include alpha channel
bool igl::opengl::texture_from_tga | ( | const std::string | tga_file, |
GLuint & | id | ||
) |
Read an image from a .tga file and use it as a texture.
[in] | tga_file | path to .tga file |
[out] | id | of generated openGL texture |
|
extern |
int igl::opengl::gli_verbose | ( | int | new_verbose | ) |
|
extern |
void igl::opengl::writeTGA | ( | gliGenericImage * | image, |
FILE * | fp | ||
) |
GLint igl::opengl::bind_vertex_attrib_array | ( | const GLuint | program_shader, |
const std::string & | name, | ||
GLuint | bufferID, | ||
const Eigen::Matrix< Scalar, RowsAtCompileTime, ColsAtCompileTime, Eigen::RowMajor > & | M, | ||
const bool | refresh | ||
) |
Bind a per-vertex array attribute and refresh its contents from an Eigen matrix.
[in] | program_shader | id of shader program |
[in] | name | name of attribute in vertex shader |
[in] | bufferID | id of buffer to bind to |
[in] | M | #V by dim matrix of per-vertex data |
[in] | refresh | whether to actually call glBufferData or just bind the buffer |
void igl::opengl::create_index_vbo | ( | const Eigen::MatrixXi & | F, |
GLuint & | F_vbo_id | ||
) |
Create a VBO (Vertex Buffer Object) for a list of indices: GL_ELEMENT_ARRAY_BUFFER_ARB for the triangle indices (F)
[in] | F | #F by 3 eigen Matrix of face (triangle) indices |
[out] | F_vbo_id | buffer id for face indices |
void igl::opengl::create_mesh_vbo | ( | const Eigen::MatrixXd & | V, |
const Eigen::MatrixXi & | F, | ||
GLuint & | V_vbo_id, | ||
GLuint & | F_vbo_id | ||
) |
Create a VBO (Vertex Buffer Object) for a mesh.
Actually two VBOs: one GL_ARRAY_BUFFER for the vertex positions (V) and one GL_ELEMENT_ARRAY_BUFFER for the triangle indices (F)
[in] | V | #V by 3 eigen Matrix of mesh vertex 3D positions |
[in] | F | #F by 3 eigen Matrix of face (triangle) indices |
[out] | V_vbo_id | buffer id for vertex positions |
[out] | F_vbo_id | buffer id for face indices |
void igl::opengl::create_mesh_vbo | ( | const Eigen::MatrixXd & | V, |
const Eigen::MatrixXi & | F, | ||
const Eigen::MatrixXd & | N, | ||
GLuint & | V_vbo_id, | ||
GLuint & | F_vbo_id, | ||
GLuint & | N_vbo_id | ||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
[in] | N | #V by 3 eigen Matrix of mesh vertex 3D normals |
[out] | N_vbo_id | buffer id for vertex positions |
bool igl::opengl::create_shader_program | ( | const std::string & | geom_source, |
const std::string & | vert_source, | ||
const std::string & | frag_source, | ||
const std::map< std::string, GLuint > & | attrib, | ||
GLuint & | id | ||
) |
Create a shader program with a vertex and fragments shader loading from source strings and vertex attributes assigned from a map before linking the shaders to the program, making it ready to use with glUseProgram(id)
[in] | geom_source | string containing source code of geometry shader (can be "" to mean use default pass-through) |
[in] | vert_source | string containing source code of vertex shader |
[in] | frag_source | string containing source code of fragment shader |
[in] | attrib | map containing table of vertex attribute strings add their correspondingly ids (generated previously using glBindAttribLocation) |
[out] | id | index id of created shader, set to 0 on error |
bool igl::opengl::create_shader_program | ( | const std::string & | vert_source, |
const std::string & | frag_source, | ||
const std::map< std::string, GLuint > & | attrib, | ||
GLuint & | id | ||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
GLuint igl::opengl::create_shader_program | ( | const std::string & | geom_source, |
const std::string & | vert_source, | ||
const std::string & | frag_source, | ||
const std::map< std::string, GLuint > & | attrib | ||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
GLuint igl::opengl::create_shader_program | ( | const std::string & | vert_source, |
const std::string & | frag_source, | ||
const std::map< std::string, GLuint > & | attrib | ||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void igl::opengl::create_vector_vbo | ( | const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > & | V, |
GLuint & | V_vbo_id | ||
) |
Create a VBO (Vertex Buffer Object) for a list of vectors: GL_ARRAY_BUFFER for the vectors (V)
T | should be a eigen matrix primitive type like int or double |
[in] | V | m by n eigen Matrix of type T values |
[out] | V_vbo_id | buffer id for vectors |
bool igl::opengl::destroy_shader_program | ( | const GLuint | id | ) |
Properly destroy a shader program.
Detach and delete each of its shaders and delete it
[in] | id | index id of created shader, set to 0 on error |
int igl::opengl::gl_type_size | ( | const GLenum | type | ) |
Return the number of bytes for a given OpenGL type.
[in] | type | enum value of opengl type |
void igl::opengl::init_render_to_texture | ( | const size_t | width, |
const size_t | height, | ||
const bool | depth_texture, | ||
GLuint & | tex_id, | ||
GLuint & | fbo_id, | ||
GLuint & | d_id | ||
) |
Create a frame buffer that renders color to a RGBA texture a depth to a "render buffer".
After calling this, you can use with something like:
[in] | width | image width |
[in] | height | image height |
[in] | depth_texture | whether to create a texture for depth or to create a render buffer for depth |
[out] | tex_id | id of the texture |
[out] | fbo_id | id of the frame buffer object |
[out] | d_id | id of the depth texture or frame buffer object |
void igl::opengl::init_render_to_texture | ( | const size_t | width, |
const size_t | height, | ||
GLuint & | tex_id, | ||
GLuint & | fbo_id, | ||
GLuint & | dfbo_id | ||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Wrapper with depth_texture = false for legacy reasons
GLuint igl::opengl::load_shader | ( | const std::string & | src, |
const GLenum | type | ||
) |
Creates and compiles a shader from a given string.
[in] | src | string containing GLSL shader code |
[in] | type | GLSL type of shader, one of: GL_VERTEX_SHADER GL_FRAGMENT_SHADER GL_GEOMETRY_SHADER |
Will immediately return 0 if src is empty.
void igl::opengl::print_program_info_log | ( | const GLuint | obj | ) |
Print the information log for a program object.
[in] | obj | OpenGL index of program to print info log about |
void igl::opengl::print_shader_info_log | ( | const GLuint | obj | ) |
Print the info log for a shader object.
[in] | obj | OpenGL index of shader to print info log about |
void igl::opengl::read_pixels | ( | const GLuint | width, |
const GLuint | height, | ||
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > & | R, | ||
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > & | G, | ||
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > & | B, | ||
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > & | A, | ||
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > & | D | ||
) |
Read full viewport into color, alpha and depth arrays suitable for igl::png::writePNG.
[in] | width | width of viewport |
[in] | height | height of viewport |
[out] | R | width by height list of red values |
[out] | G | width by height list of green values |
[out] | B | width by height list of blue values |
[out] | A | width by height list of alpha values |
[out] | D | width by height list of depth values |
GLenum igl::opengl::report_gl_error | ( | const std::string | id | ) |
Print last OpenGL error to stderr prefixed by specified id string.
[in] | id | string to appear before any error msgs |
GLenum igl::opengl::report_gl_error | ( | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
std::string igl::opengl::uniform_type_to_string | ( | const GLenum | type | ) |
Convert a GL uniform variable type (say, returned from glGetActiveUniform) and output a string naming that type.
[in] | type | enum for given type |
void igl::opengl::decompress_verasansmono_atlas | ( | unsigned char * | _fontatlas | ) |
Decompress the vera sans mono font atlas.
void igl::opengl::vertex_array | ( | const Eigen::PlainObjectBase< DerivedV > & | V, |
const Eigen::PlainObjectBase< DerivedF > & | F, | ||
GLuint & | va_id, | ||
GLuint & | ab_id, | ||
GLuint & | eab_id | ||
) |
Create a GL_VERTEX_ARRAY for a given mesh (V,F)
[in] | V | #V by dim list of mesh vertex positions |
[in] | F | #F by 3 list of mesh triangle indices into V |
[out] | va_id | id of vertex array |
[out] | ab_id | id of array buffer (vertex buffer object) |
[out] | eab_id | id of element array buffer (element/face buffer object) |
Eigen::PlainObjectBase
because we want to directly access it's underlying storage. It cannot be Eigen::MatrixBase
(see http://stackoverflow.com/questions/25094948/)