mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-03 17:30:04 -05:00
Add class GPUTexture
This commit is contained in:
@@ -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__
|
||||
|
||||
Reference in New Issue
Block a user