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, float near=0.1, float far=10.0) | |
constructs the frame buffer object in a new OpenGL context. More... | |
~GLRenderer () | |
destructor, destroys frame buffer objects and OpenGL context More... | |
void | begin () const |
initializes the frame buffers for rendering and or manipulating More... | |
void | end () const |
finalizes the frame buffers after rendering and/or manipulating More... | |
void | callList (GLuint list) const |
executes a OpenGL list More... | |
void | getColorBuffer (unsigned char *buffer) const |
retrieves the color buffer from OpenGL More... | |
void | getDepthBuffer (float *buffer) const |
retrieves the depth buffer from OpenGL More... | |
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. More... | |
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. More... | |
void | setCameraParameters (float fx, float fy, float cx, float cy) |
set the camera parameters More... | |
void | setClippingRange (float near, float far) |
sets the near and far clipping plane distances in meters More... | |
const float & | getNearClippingDistance () const |
returns the distance of the near clipping plane in meters More... | |
const float & | getFarClippingDistance () const |
returns the distance of the far clipping plane in meters More... | |
unsigned | getWidth () const |
returns the width of the frame buffer objectsin pixels More... | |
unsigned | getHeight () const |
returns the height of the frame buffer objects in pixels More... | |
void | setBufferSize (unsigned width, unsigned height) |
set the size of fram buffers More... | |
const GLuint & | getProgramID () const |
GLuint | getDepthTexture () const |
returns the handle of the depth buffer as an OpenGL texture object More... | |
GLuint | getColorTexture () const |
returns the handle of the color buffer as an OpenGL texture object More... | |
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, | ||
float | near = 0.1 , |
||
float | 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 58 of file gl_renderer.cpp.
mesh_filter::GLRenderer::~GLRenderer | ( | ) |
destructor, destroys frame buffer objects and OpenGL context
Definition at line 77 of file gl_renderer.cpp.
void mesh_filter::GLRenderer::begin | ( | ) | const |
initializes the frame buffers for rendering and or manipulating
Definition at line 185 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 195 of file gl_renderer.cpp.
void mesh_filter::GLRenderer::end | ( | ) | const |
finalizes the frame buffers after rendering and/or manipulating
Definition at line 202 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 209 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 435 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 217 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 440 of file gl_renderer.cpp.
const float & mesh_filter::GLRenderer::getFarClippingDistance | ( | ) | const |
returns the distance of the far clipping plane in meters
Definition at line 254 of file gl_renderer.cpp.
unsigned mesh_filter::GLRenderer::getHeight | ( | ) | const |
returns the height of the frame buffer objects in pixels
Definition at line 450 of file gl_renderer.cpp.
const float & mesh_filter::GLRenderer::getNearClippingDistance | ( | ) | const |
returns the distance of the near clipping plane in meters
Definition at line 249 of file gl_renderer.cpp.
const GLuint & mesh_filter::GLRenderer::getProgramID | ( | ) | const |
Definition at line 244 of file gl_renderer.cpp.
unsigned mesh_filter::GLRenderer::getWidth | ( | ) | const |
returns the width of the frame buffer objectsin pixels
Definition at line 445 of file gl_renderer.cpp.
void mesh_filter::GLRenderer::setBufferSize | ( | unsigned | width, |
unsigned | height | ||
) |
set the size of fram buffers
[in] | width | width of frame buffer in pixels |
[in] | height | height of frame buffer in pixels |
Definition at line 84 of file gl_renderer.cpp.
void mesh_filter::GLRenderer::setCameraParameters | ( | float | fx, |
float | fy, | ||
float | cx, | ||
float | 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 105 of file gl_renderer.cpp.
void mesh_filter::GLRenderer::setClippingRange | ( | float | near, |
float | 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 95 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 225 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 238 of file gl_renderer.cpp.