Class for rendering surface meshes using OpenGL. More...
#include <pmp/viewers/renderer.h>
Public Member Functions | |
| Renderer (const SurfaceMesh &mesh) | |
| Constructor. | |
| ~Renderer () | |
| Default destructor, deletes all OpenGL buffers. | |
| const vec3 & | front_color () const |
| get front color | |
| void | set_front_color (const vec3 &color) |
| set front color | |
| const vec3 & | back_color () const |
| get back color | |
| void | set_back_color (const vec3 &color) |
| set back color | |
| float | ambient () const |
| get ambient reflection coefficient | |
| void | set_ambient (float a) |
| set ambient reflection coefficient | |
| float | diffuse () const |
| get diffuse reflection coefficient | |
| void | set_diffuse (float d) |
| set diffuse reflection coefficient | |
| float | specular () const |
| get specular reflection coefficient | |
| void | set_specular (float s) |
| set specular reflection coefficient | |
| float | shininess () const |
| get specular shininess coefficient | |
| void | set_shininess (float s) |
| set specular shininess coefficient | |
| float | alpha () const |
| get alpha value for transparent rendering | |
| void | set_alpha (float a) |
| set alpha value for transparent rendering | |
| Scalar | crease_angle () const |
| get crease angle (in degrees) for visualization of sharp edges | |
| void | set_crease_angle (Scalar ca) |
| set crease angle (in degrees) for visualization of sharp edges | |
| int | point_size () const |
| get point size for visualization of points | |
| void | set_point_size (int ps) |
| set point size for visualization of points | |
| void | set_use_colors (bool use_colors) |
| Control usage of color information. | |
| void | draw (const mat4 &projection_matrix, const mat4 &modelview_matrix, const std::string &draw_mode) |
| Draw the mesh. | |
| void | update_opengl_buffers () |
| Update all OpenGL buffers for rendering. | |
| void | use_cold_warm_texture () |
| Use color map to visualize scalar fields. | |
| void | use_checkerboard_texture () |
| Use checkerboard texture. | |
| void | load_texture (const std::filesystem::path &filename, GLint format=GL_RGB, GLint min_filter=GL_LINEAR_MIPMAP_LINEAR, GLint mag_filter=GL_LINEAR, GLint wrap=GL_CLAMP_TO_EDGE) |
| Load texture from file. | |
| void | load_matcap (const std::filesystem::path &filename) |
| Load mat-cap texture from file. | |
| void | add_overlay (std::shared_ptr< Drawable > drawable) |
| Add a drawable overlay. | |
Class for rendering surface meshes using OpenGL.
Load mat-cap texture from file.
The mat-cap will be used whenever the drawing mode is "Texture". This also means that you cannot have texture and mat-cap at the same time.
| filename | the location and name of the texture |
| IOException | in case of failure to load texture from file |
| void load_texture | ( | const std::filesystem::path & | filename, |
| GLint | format = GL_RGB, |
||
| GLint | min_filter = GL_LINEAR_MIPMAP_LINEAR, |
||
| GLint | mag_filter = GL_LINEAR, |
||
| GLint | wrap = GL_CLAMP_TO_EDGE |
||
| ) |
Load texture from file.
| filename | the location and name of the texture |
| format | internal format (GL_RGB, GL_RGBA, GL_SRGB8, etc.) |
| min_filter | interpolation filter for minification |
| mag_filter | interpolation filter for magnification |
| wrap | texture coordinates wrap preference |
| IOException | in case of failure to load texture from file |
Control usage of color information.
Either per-vertex or per-face colors can be used. Vertex colors are only used if the mesh has a per-vertex property of type Color named "v:color". Face colors are only used if the mesh has a per-face property of type Color named "f:color". If set to false, the default front and back colors are used. Default is true.