moveit2
The MoveIt Motion Planning Framework for ROS 2.
|
Abstracts the OpenGL frame buffer objects, and provides an interface to render meshes, and retrieve the color and depth ap from opengl. More...
#include <gl_renderer.h>
Public Member Functions | |
GLRenderer (unsigned width, unsigned height, double near=0.1, double far=10.0) | |
constructs the frame buffer object in a new OpenGL context. | |
~GLRenderer () | |
destructor, destroys frame buffer objects and OpenGL context | |
void | begin () const |
initializes the frame buffers for rendering and or manipulating | |
void | end () const |
finalizes the frame buffers after rendering and/or manipulating | |
void | callList (GLuint list) const |
executes a OpenGL list | |
void | getColorBuffer (unsigned char *buffer) const |
retrieves the color buffer from OpenGL | |
void | getDepthBuffer (float *buffer) const |
retrieves the depth buffer from OpenGL | |
GLuint | setShadersFromFile (const std::string &vertex_filename, const std::string &fragment_filename) |
loads, compiles, links and adds GLSL shaders from files to the current OpenGL context. | |
GLuint | setShadersFromString (const std::string &vertex_shader, const std::string &fragment_shader) |
loads, compiles, links and adds GLSL shaders from string to the current OpenGL context. | |
void | setCameraParameters (double fx, double fy, double cx, double cy) |
set the camera parameters | |
void | setClippingRange (double near, double far) |
sets the near and far clipping plane distances in meters | |
const double & | getNearClippingDistance () const |
returns the distance of the near clipping plane in meters | |
const double & | getFarClippingDistance () const |
returns the distance of the far clipping plane in meters | |
unsigned | getWidth () const |
returns the width of the frame buffer objectsin pixels | |
unsigned | getHeight () const |
returns the height of the frame buffer objects in pixels | |
void | setBufferSize (unsigned width, unsigned height) |
set the size of frame buffers | |
const GLuint & | getProgramID () const |
GLuint | getDepthTexture () const |
returns the handle of the depth buffer as an OpenGL texture object | |
GLuint | getColorTexture () const |
returns the handle of the color buffer as an OpenGL texture object | |
Abstracts the OpenGL frame buffer objects, and provides an interface to render meshes, and retrieve the color and depth ap from opengl.
Definition at line 62 of file gl_renderer.h.
mesh_filter::GLRenderer::GLRenderer | ( | unsigned | width, |
unsigned | height, | ||
double | near = 0.1 , |
||
double | far = 10.0 |
||
) |
constructs the frame buffer object in a new OpenGL context.
[in] | width | the width of the frame buffers |
[in] | height | height of the framebuffers |
[in] | near | distance of the near clipping plane in meters |
[in] | far | distance of the far clipping plane in meters |
Definition at line 57 of file gl_renderer.cpp.
mesh_filter::GLRenderer::~GLRenderer | ( | ) |
destructor, destroys frame buffer objects and OpenGL context
Definition at line 76 of file gl_renderer.cpp.
void mesh_filter::GLRenderer::begin | ( | ) | const |
initializes the frame buffers for rendering and or manipulating
Definition at line 184 of file gl_renderer.cpp.
void mesh_filter::GLRenderer::callList | ( | GLuint | list | ) | const |
executes a OpenGL list
[in] | list | the handle of the OpenGL list to be executed |
Definition at line 194 of file gl_renderer.cpp.
void mesh_filter::GLRenderer::end | ( | ) | const |
finalizes the frame buffers after rendering and/or manipulating
Definition at line 201 of file gl_renderer.cpp.
void mesh_filter::GLRenderer::getColorBuffer | ( | unsigned char * | buffer | ) | const |
retrieves the color buffer from OpenGL
[out] | buffer | pointer to memory where the color values need to be stored |
Definition at line 208 of file gl_renderer.cpp.
GLuint mesh_filter::GLRenderer::getColorTexture | ( | ) | const |
returns the handle of the color buffer as an OpenGL texture object
Definition at line 436 of file gl_renderer.cpp.
void mesh_filter::GLRenderer::getDepthBuffer | ( | float * | buffer | ) | const |
retrieves the depth buffer from OpenGL
[out] | buffer | pointer to memory where the depth values need to be stored |
Definition at line 216 of file gl_renderer.cpp.
GLuint mesh_filter::GLRenderer::getDepthTexture | ( | ) | const |
returns the handle of the depth buffer as an OpenGL texture object
Definition at line 441 of file gl_renderer.cpp.
const double & mesh_filter::GLRenderer::getFarClippingDistance | ( | ) | const |
returns the distance of the far clipping plane in meters
Definition at line 253 of file gl_renderer.cpp.
unsigned mesh_filter::GLRenderer::getHeight | ( | ) | const |
returns the height of the frame buffer objects in pixels
Definition at line 451 of file gl_renderer.cpp.
const double & mesh_filter::GLRenderer::getNearClippingDistance | ( | ) | const |
returns the distance of the near clipping plane in meters
Definition at line 248 of file gl_renderer.cpp.
const GLuint & mesh_filter::GLRenderer::getProgramID | ( | ) | const |
Definition at line 243 of file gl_renderer.cpp.
unsigned mesh_filter::GLRenderer::getWidth | ( | ) | const |
returns the width of the frame buffer objectsin pixels
Definition at line 446 of file gl_renderer.cpp.
void mesh_filter::GLRenderer::setBufferSize | ( | unsigned | width, |
unsigned | height | ||
) |
set the size of frame buffers
[in] | width | width of frame buffer in pixels |
[in] | height | height of frame buffer in pixels |
Definition at line 83 of file gl_renderer.cpp.
void mesh_filter::GLRenderer::setCameraParameters | ( | double | fx, |
double | fy, | ||
double | cx, | ||
double | cy | ||
) |
set the camera parameters
[in] | fx | focal length in x-direction |
[in] | fy | focal length in y-direction |
[in] | cx | x component of principal point |
[in] | cy | y component of principal point |
Definition at line 104 of file gl_renderer.cpp.
void mesh_filter::GLRenderer::setClippingRange | ( | double | near, |
double | far | ||
) |
sets the near and far clipping plane distances in meters
[in] | near | distance of the near clipping plane in meters |
[in] | far | distance of the far clipping plane in meters |
Definition at line 94 of file gl_renderer.cpp.
GLuint mesh_filter::GLRenderer::setShadersFromFile | ( | const std::string & | vertex_filename, |
const std::string & | fragment_filename | ||
) |
loads, compiles, links and adds GLSL shaders from files to the current OpenGL context.
[in] | vertex_filename | path to vertex shader source code. Can set to "" (empty string) if no vertex shader is used. |
[in] | fragment_filename | path to fragemnt shader source code. Can be set to "" if no fragment shader is used. |
Definition at line 224 of file gl_renderer.cpp.
GLuint mesh_filter::GLRenderer::setShadersFromString | ( | const std::string & | vertex_shader, |
const std::string & | fragment_shader | ||
) |
loads, compiles, links and adds GLSL shaders from string to the current OpenGL context.
[in] | vertex_shader | source code of the vertex shader. Can be "" if no vertex shader is used. |
[in] | fragment_shader | source code of the fragment shader. Can be "" if no fragment shader is used. |
Definition at line 237 of file gl_renderer.cpp.