42 #include <OpenGL/gl.h>
73 GLRenderer(
unsigned width,
unsigned height,
float near = 0.1,
float far = 10.0);
119 GLuint
setShadersFromFile(
const std::string& vertex_filename,
const std::string& fragment_filename);
128 GLuint
setShadersFromString(
const std::string& vertex_shader,
const std::string& fragment_shader);
210 void setCameraParameters()
const;
218 void readShaderCodeFromFile(
const std::string& filename, std::string& source)
const;
227 GLuint loadShaders(
const std::string& vertex_source,
const std::string& fragment_source)
const;
236 GLuint createShader(GLuint shaderID,
const std::string& source)
const;
242 void initFrameBuffers();
248 void deleteFrameBuffers();
254 static void createGLContext();
260 static void deleteGLContext();
302 static std::map<std::thread::id, std::pair<unsigned, GLuint> > context_;
305 static std::mutex context_lock_;
307 static bool glutInitialized_;
Abstracts the OpenGL frame buffer objects, and provides an interface to render meshes,...
void getDepthBuffer(float *buffer) const
retrieves the depth buffer from OpenGL
void setBufferSize(unsigned width, unsigned height)
set the size of fram buffers
void callList(GLuint list) const
executes a OpenGL list
GLuint getColorTexture() const
returns the handle of the color buffer as an OpenGL texture object
GLuint getDepthTexture() const
returns the handle of the depth buffer as an OpenGL texture object
unsigned getWidth() const
returns the width of the frame buffer objectsin pixels
void setCameraParameters(float fx, float fy, float cx, float cy)
set the camera parameters
GLRenderer(unsigned width, unsigned height, float near=0.1, float far=10.0)
constructs the frame buffer object in a new OpenGL context.
void end() const
finalizes the frame buffers after rendering and/or manipulating
void begin() const
initializes the frame buffers for rendering and or manipulating
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.
void setClippingRange(float near, float far)
sets the near and far clipping plane distances in meters
void getColorBuffer(unsigned char *buffer) const
retrieves the color buffer from OpenGL
unsigned getHeight() const
returns the height of the frame buffer objects in pixels
const float & getNearClippingDistance() const
returns the distance of the near clipping plane in meters
const float & getFarClippingDistance() const
returns the distance of the far clipping plane in meters
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.
~GLRenderer()
destructor, destroys frame buffer objects and OpenGL context
const GLuint & getProgramID() const
MOVEIT_CLASS_FORWARD(Job)