Polygon Mesh Processing Library
Loading...
Searching...
No Matches
Renderer Class Reference

Class for rendering surface meshes using OpenGL. More...

#include <pmp/visualization/renderer.h>

Public Member Functions

 Renderer (const SurfaceMesh &mesh)
 Constructor.
 
 ~Renderer ()
 Default destructor, deletes all OpenGL buffers.
 
const vec3front_color () const
 get front color
 
void set_front_color (const vec3 &color)
 set front color
 
const vec3back_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
 
float point_size () const
 get point size for visualization of points
 
void set_point_size (float 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 char *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 char *filename)
 Load mat-cap texture from file.
 

Detailed Description

Class for rendering surface meshes using OpenGL.

Member Function Documentation

◆ load_matcap()

void load_matcap ( const char *  filename)

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.

Parameters
filenamethe location and name of the texture
See also
See src/apps/mview.cpp for an example usage.
Exceptions
IOExceptionin case of failure to load texture from file

◆ load_texture()

void load_texture ( const char *  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.

Parameters
filenamethe location and name of the texture
formatinternal format (GL_RGB, GL_RGBA, GL_SRGB8, etc.)
min_filterinterpolation filter for minification
mag_filterinterpolation filter for magnification
wraptexture coordinates wrap preference
Exceptions
IOExceptionin case of failure to load texture from file

◆ set_use_colors()

void set_use_colors ( bool  use_colors)
inline

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.

Note
Vertex colors take precedence over face colors.