made ShaderEffects individully handle texture units for sent images/canvases, added GL helper function for quickly binding a texture to a specific texture unit, hopefully made ShaderEffects load and unload volatile better

This commit is contained in:
Alexander Szpakowski
2012-12-22 00:29:11 -04:00
parent 16f925affa
commit 79fa42d207
5 changed files with 114 additions and 26 deletions
+4 -2
View File
@@ -35,7 +35,7 @@ namespace graphics
{
namespace opengl
{
// A fragment shader
// A GLSL shader
class ShaderEffect : public Object, public Volatile
{
public:
@@ -46,7 +46,7 @@ public:
virtual bool loadVolatile();
virtual void unloadVolatile();
void attach();
void attach(bool temporary = false);
static void detach();
static std::string getGLSLVersion();
@@ -75,7 +75,9 @@ private:
// texture unit pool for setting images
static GLint _current_texture_unit;
static GLint _max_texture_units;
std::map<std::string, GLint> _texture_unit_pool;
std::vector<GLuint> _texture_id_list;
GLint getTextureUnit(const std::string &name);
void sendTexture(const std::string &name, GLuint texture);