zMol
A viewer for molecular data using OpenGL and ambient occlusion
Public Member Functions
zmol::molecule_shaders Class Reference

#include <molecule_renderer.hpp>

Inherits zmol::noncopyable_::noncopyable.

List of all members.

Public Member Functions

 molecule_shaders (std::function< void(std::string const &p_errormsg) > const &p_errormsg_callback)

Detailed Description

Flyweight containing shaders used by molecule renderers.

The renderers require several shaders, all of which are compiled in this class. Only one instance has to exist per OpenGL context; multiple molecule renderers can share the same molecule_shaders instance. If the only goal is to use the molecule_renderer, all that needs to be done is to instantiate this class at least once, and pass it to the molecule_renderer constructor; note though, that the molecule_renderer does not take ownership of this class. The easiest way to use this is to just instantiate it, keep it around somewhere (for example, as a class member), and pass it as argument to the molecule_renderers. Destroy the molecule_shaders instance only after all instances of molecule_renderer that use it are destroyed.

It is not copyable, to avoid issues with duplicated shaders. (Copying instances of this classes makes no sense anyway.)


Constructor & Destructor Documentation

zmol::molecule_shaders::molecule_shaders ( std::function< void(std::string const &p_errormsg) > const &  p_errormsg_callback)
explicit

Constructor.

Parameters:
p_errormsg_callbackCallback to be used for when a GLSL compilation or linking error occurs.

Shaders for drawing the textured spheres to the screen

Shaders for drawing the spheres to the shadowmap

Shaders for drawing shadowed spheres to the atlas (Using the shadowmap computed by the shaders above)

Shaders for drawing the textured cylinders to the screen