Add class GPUTexture

This commit is contained in:
Erik Broberg
2016-10-19 11:30:31 +02:00
parent 0476c32994
commit 979bf1f992
+20 -1
View File
@@ -31,6 +31,7 @@
#include <ghoul/opengl/textureunit.h>
#include <string>
#include <memory>
namespace openspace {
@@ -44,7 +45,7 @@ public:
program->setUniform(_uniformLocation, val);
}
void updateUniformLocation(ProgramObject* program, const std::string& name){
void update(ProgramObject* program, const std::string& name){
_uniformLocation = program->uniformLocation(name);
}
@@ -52,6 +53,24 @@ protected:
GLint _uniformLocation = -1;
};
class GPUTexture{
public:
void setValue(ProgramObject* program, std::shared_ptr<Texture> texture){
_texUnit.activate();
texture->bind();
program->setUniform(_uniformLocation, _texUnit);
}
void update(ProgramObject* program, const std::string& name){
_uniformLocation = program->uniformLocation(name);
}
private:
GLint _uniformLocation = -1;
TextureUnit _texUnit;
};
} // namespace openspace
#endif // __GPUDATA_H__