mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-07 04:00:37 -06:00
Removed the use of flare texture and shader classes
This commit is contained in:
@@ -158,9 +158,11 @@ bool BrickManager::InitAtlas() {
|
||||
dims.push_back(atlasDim_);
|
||||
dims.push_back(atlasDim_);
|
||||
dims.push_back(atlasDim_);
|
||||
textureAtlas_ = Texture3D::New(dims);
|
||||
textureAtlas_ = new ghoul::opengl::Texture(glm::size3_t(atlasDim_, atlasDim_, atlasDim_), ghoul::opengl::Texture::Format::RGBA, GL_RGBA, GL_FLOAT);
|
||||
textureAtlas_->uploadTexture();
|
||||
//textureAtlas_ = Texture3D::New(dims);
|
||||
|
||||
if (!textureAtlas_->Init()) return false;
|
||||
//if (!textureAtlas_->Init()) return false;
|
||||
|
||||
atlasInitialized_ = true;
|
||||
|
||||
@@ -449,11 +451,30 @@ bool BrickManager::DiskToPBO(BUFFER_INDEX _pboIndex) {
|
||||
|
||||
bool BrickManager::PBOToAtlas(BUFFER_INDEX _pboIndex) {
|
||||
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, pboHandle_[_pboIndex]);
|
||||
glm::size3_t dim = textureAtlas_->dimensions();
|
||||
glGetError();
|
||||
glBindTexture(GL_TEXTURE_3D, *textureAtlas_);
|
||||
glTexSubImage3D(GL_TEXTURE_3D,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
dim[0],
|
||||
dim[1],
|
||||
dim[2],
|
||||
GL_RED,
|
||||
GL_FLOAT,
|
||||
NULL);
|
||||
glBindTexture(GL_TEXTURE_3D, 0);
|
||||
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
|
||||
|
||||
return (CheckGLError("Texture3D::UpdateSubRegion") == GL_NO_ERROR);
|
||||
/*
|
||||
if (!textureAtlas_->UpdateSubRegion(0, 0, 0,
|
||||
textureAtlas_->Dim(0),
|
||||
textureAtlas_->Dim(1),
|
||||
textureAtlas_->Dim(2),
|
||||
0)) return false;
|
||||
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
|
||||
return true;
|
||||
*/
|
||||
//return true;
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <fstream>
|
||||
#include <boost/timer/timer.hpp>
|
||||
#include <stdio.h>
|
||||
#include <ghoul/opengl/texture.h>
|
||||
|
||||
// Make sure we get 64 bits for offset
|
||||
#define _FILE_OFFSET_BITS 64
|
||||
@@ -21,7 +22,6 @@
|
||||
|
||||
namespace osp {
|
||||
|
||||
class Texture3D;
|
||||
class Config;
|
||||
|
||||
class BrickManager {
|
||||
@@ -53,7 +53,7 @@ public:
|
||||
return brickLists_[_bufIdx];
|
||||
}
|
||||
|
||||
Texture3D * TextureAtlas() { return textureAtlas_; }
|
||||
ghoul::opengl::Texture * TextureAtlas() { return textureAtlas_; }
|
||||
|
||||
// Header accessors
|
||||
unsigned int GridType() const { return gridType_; }
|
||||
@@ -106,7 +106,7 @@ private:
|
||||
int zCoord_;
|
||||
|
||||
// Texture where the actual atlas is kept
|
||||
Texture3D *textureAtlas_;
|
||||
ghoul::opengl::Texture *textureAtlas_;
|
||||
|
||||
std::vector<std::vector<int> > brickLists_;
|
||||
|
||||
|
||||
@@ -196,7 +196,7 @@ bool CLManager::CreateKernel(std::string _programName) {
|
||||
|
||||
|
||||
bool CLManager::AddTexture(std::string _programName, unsigned int _argNr,
|
||||
Texture *_texture, TextureType _textureType,
|
||||
ghoul::opengl::Texture *_texture, TextureType _textureType,
|
||||
Permissions _permissions) {
|
||||
cl_mem_flags flag = ConvertPermissions(_permissions);
|
||||
|
||||
@@ -226,7 +226,7 @@ bool CLManager::AddTexture(std::string _programName, unsigned int _argNr,
|
||||
}
|
||||
|
||||
bool CLManager::AddTexture(std::string _programName, unsigned int _argNr,
|
||||
Texture *_texture, TextureType _textureType,
|
||||
ghoul::opengl::Texture *_texture, TextureType _textureType,
|
||||
Permissions _permissions, cl_mem& _clTextureMem) {
|
||||
|
||||
cl_mem_flags flag = ConvertPermissions(_permissions);
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
namespace osp {
|
||||
|
||||
class Texture;
|
||||
class TransferFunction;
|
||||
class CLProgram;
|
||||
class TSP;
|
||||
@@ -50,11 +49,11 @@ public:
|
||||
|
||||
// Add an OpenGL texture to a program
|
||||
bool AddTexture(std::string _programName, unsigned int _argNr,
|
||||
Texture *_texture, TextureType _textureType,
|
||||
ghoul::opengl::Texture *_texture, TextureType _textureType,
|
||||
Permissions _permissions);
|
||||
|
||||
bool AddTexture(std::string _programName, unsigned int _argNr,
|
||||
Texture *_texture, TextureType _textureType,
|
||||
ghoul::opengl::Texture *_texture, TextureType _textureType,
|
||||
Permissions _permissions, cl_mem& _clTextureMem);
|
||||
|
||||
bool AddTexture(std::string _programName, unsigned int _argNr,
|
||||
|
||||
@@ -74,7 +74,7 @@ bool CLProgram::CreateKernel() {
|
||||
}
|
||||
|
||||
|
||||
bool CLProgram::AddTexture(unsigned int _argNr, Texture *_texture,
|
||||
bool CLProgram::AddTexture(unsigned int _argNr, ghoul::opengl::Texture *_texture,
|
||||
GLuint _textureType,
|
||||
cl_mem_flags _permissions) {
|
||||
|
||||
@@ -93,22 +93,22 @@ bool CLProgram::AddTexture(unsigned int _argNr, Texture *_texture,
|
||||
#ifdef CL_VERSION_1_2
|
||||
texture = clCreateFromGLTexture(clManager_->_context, _permissions,
|
||||
GL_TEXTURE_2D, 0,
|
||||
_texture->Handle(), &error_);
|
||||
*_texture, &error_);
|
||||
#else
|
||||
texture = clCreateFromGLTexture2D(clManager_->_context, _permissions,
|
||||
GL_TEXTURE_2D, 0,
|
||||
_texture->Handle(), &error_);
|
||||
*_texture, &error_);
|
||||
#endif
|
||||
break;
|
||||
case GL_TEXTURE_3D:
|
||||
#ifdef CL_VERSION_1_2
|
||||
texture = clCreateFromGLTexture(clManager_->_context, _permissions,
|
||||
GL_TEXTURE_3D, 0,
|
||||
_texture->Handle(), &error_);
|
||||
*_texture, &error_);
|
||||
#else
|
||||
texture = clCreateFromGLTexture3D(clManager_->_context, _permissions,
|
||||
GL_TEXTURE_3D, 0,
|
||||
_texture->Handle(), &error_);
|
||||
*_texture, &error_);
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
@@ -125,7 +125,7 @@ bool CLProgram::AddTexture(unsigned int _argNr, Texture *_texture,
|
||||
}
|
||||
|
||||
|
||||
bool CLProgram::AddTexture(unsigned int _argNr, Texture *_texture,
|
||||
bool CLProgram::AddTexture(unsigned int _argNr, ghoul::opengl::Texture *_texture,
|
||||
GLuint _textureType,
|
||||
cl_mem_flags _permissions,
|
||||
cl_mem& _clTextureMem) {
|
||||
@@ -144,22 +144,22 @@ bool CLProgram::AddTexture(unsigned int _argNr, Texture *_texture,
|
||||
#ifdef CL_VERSION_1_2
|
||||
_clTextureMem = clCreateFromGLTexture(clManager_->_context, _permissions,
|
||||
GL_TEXTURE_2D, 0,
|
||||
_texture->Handle(), &error_);
|
||||
*_texture, &error_);
|
||||
#else
|
||||
_clTextureMem = clCreateFromGLTexture2D(clManager_->_context, _permissions,
|
||||
GL_TEXTURE_2D, 0,
|
||||
_texture->Handle(), &error_);
|
||||
*_texture, &error_);
|
||||
#endif
|
||||
break;
|
||||
case GL_TEXTURE_3D:
|
||||
#ifdef CL_VERSION_1_2
|
||||
_clTextureMem = clCreateFromGLTexture(clManager_->_context, _permissions,
|
||||
GL_TEXTURE_3D, 0,
|
||||
_texture->Handle(), &error_);
|
||||
*_texture, &error_);
|
||||
#else
|
||||
_clTextureMem = clCreateFromGLTexture2D(clManager_->_context, _permissions,
|
||||
GL_TEXTURE_3D, 0,
|
||||
_texture->Handle(), &error_);
|
||||
*_texture, &error_);
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <flare/KernelConstants.h>
|
||||
#include <ghoul/opengl/texture.h>
|
||||
|
||||
namespace osp {
|
||||
|
||||
@@ -36,11 +37,11 @@ public:
|
||||
bool BuildProgram();
|
||||
bool CreateKernel();
|
||||
|
||||
bool AddTexture(unsigned int _argNr, Texture *_texture,
|
||||
bool AddTexture(unsigned int _argNr, ghoul::opengl::Texture *_texture,
|
||||
GLuint _textureType,
|
||||
cl_mem_flags _permissions);
|
||||
|
||||
bool AddTexture(unsigned int _argNr, Texture *_texture,
|
||||
bool AddTexture(unsigned int _argNr, ghoul::opengl::Texture *_texture,
|
||||
GLuint _textureType,
|
||||
cl_mem_flags _permissions, cl_mem& _clTextureMem);
|
||||
|
||||
|
||||
@@ -148,8 +148,9 @@ bool Raycaster::Render(float _timestep) {
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
// Render cube
|
||||
glUseProgram(cubeShaderProgram_->Handle());
|
||||
cubePositionAttrib_ = cubeShaderProgram_->GetAttribLocation("position");
|
||||
cubeShaderProgram_->activate();
|
||||
//glUseProgram(cubeShaderProgram_->Handle());
|
||||
cubePositionAttrib_ = cubeShaderProgram_->attributeLocation("position");
|
||||
if (cubePositionAttrib_ == -1) {
|
||||
ERROR("Cube position attribute lookup failed");
|
||||
return false;
|
||||
@@ -273,12 +274,30 @@ bool Raycaster::Render(float _timestep) {
|
||||
// Render to framebuffer using quad
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, sgct::Engine::instance()->getActiveWindowPtr()->getFBOPtr()->getBufferID());
|
||||
|
||||
if (!quadTex_->Bind(quadShaderProgram_, "quadTex", 0)) return false;
|
||||
glGetError();
|
||||
quadShaderProgram_->activate();
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
int location = quadShaderProgram_->uniformLocation("quadTex");
|
||||
//int location = glGetUniformLocation(_shaderProgram->Handle(),_uniformName.c_str());
|
||||
if (location == -1) {
|
||||
ERROR("Uniform " << "quadTex" << " could not be found");
|
||||
glUseProgram(0);
|
||||
return false;
|
||||
}
|
||||
|
||||
glUniform1i(location, 0);
|
||||
glBindTexture(GL_TEXTURE_2D, *quadTex_);
|
||||
glUseProgram(0);
|
||||
|
||||
|
||||
//if (!quadTex_->Bind(quadShaderProgram_, "quadTex", 0)) return false;
|
||||
|
||||
glDisable(GL_CULL_FACE);
|
||||
|
||||
glUseProgram(quadShaderProgram_->Handle());
|
||||
quadPositionAttrib_ = quadShaderProgram_->GetAttribLocation("position");
|
||||
quadShaderProgram_->activate();
|
||||
//glUseProgram(quadShaderProgram_->Handle());
|
||||
//quadPositionAttrib_ = quadShaderProgram_->GetAttribLocation("position");
|
||||
quadPositionAttrib_ = quadShaderProgram_->attributeLocation("position");
|
||||
if (quadPositionAttrib_ == -1) {
|
||||
ERROR("Quad position attribute lookup failed");
|
||||
return false;
|
||||
@@ -512,7 +531,7 @@ bool Raycaster::InitFramebuffers() {
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER,
|
||||
GL_COLOR_ATTACHMENT0,
|
||||
GL_TEXTURE_2D,
|
||||
cubeFrontTex_->Handle(),
|
||||
*cubeFrontTex_,
|
||||
0);
|
||||
glFramebufferRenderbuffer(GL_FRAMEBUFFER,
|
||||
GL_DEPTH_ATTACHMENT,
|
||||
@@ -534,7 +553,7 @@ bool Raycaster::InitFramebuffers() {
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER,
|
||||
GL_COLOR_ATTACHMENT0,
|
||||
GL_TEXTURE_2D,
|
||||
cubeBackTex_->Handle(),
|
||||
*cubeBackTex_,
|
||||
0);
|
||||
glFramebufferRenderbuffer(GL_FRAMEBUFFER,
|
||||
GL_DEPTH_ATTACHMENT,
|
||||
@@ -590,23 +609,29 @@ bool Raycaster::UpdateMatrices() {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Raycaster::BindTransformationMatrices(ShaderProgram * _program)
|
||||
bool Raycaster::BindTransformationMatrices(ghoul::opengl::ProgramObject * _program)
|
||||
{
|
||||
if (!_program->setUniform("modelMatrix", model_)) return false;
|
||||
if (!_program->setUniform("viewMatrix", view_)) return false;
|
||||
if (!_program->setUniform("projectionMatrix", proj_)) return false;
|
||||
|
||||
/*
|
||||
if (!_program->BindMatrix4f("modelMatrix", &model_[0][0])) return false;
|
||||
if (!_program->BindMatrix4f("viewMatrix", &view_[0][0])) return false;
|
||||
if (!_program->BindMatrix4f("projectionMatrix", &proj_[0][0])) return false;
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
void Raycaster::SetCubeFrontTexture(Texture2D *_cubeFrontTexture) {
|
||||
void Raycaster::SetCubeFrontTexture(ghoul::opengl::Texture *_cubeFrontTexture) {
|
||||
cubeFrontTex_ = _cubeFrontTexture;
|
||||
}
|
||||
|
||||
void Raycaster::SetCubeBackTexture(Texture2D *_cubeBackTexture) {
|
||||
void Raycaster::SetCubeBackTexture(ghoul::opengl::Texture *_cubeBackTexture) {
|
||||
cubeBackTex_ = _cubeBackTexture;
|
||||
}
|
||||
|
||||
void Raycaster::SetQuadTexture(Texture2D *_quadTexture) {
|
||||
void Raycaster::SetQuadTexture(ghoul::opengl::Texture *_quadTexture) {
|
||||
quadTex_ = _quadTexture;
|
||||
}
|
||||
|
||||
@@ -618,21 +643,19 @@ void Raycaster::SetTSP(TSP *_tsp) {
|
||||
tsp_ = _tsp;
|
||||
}
|
||||
|
||||
void Raycaster::SetCubeShaderProgram(ShaderProgram *_cubeShaderProgram) {
|
||||
void Raycaster::SetCubeShaderProgram(ghoul::opengl::ProgramObject *_cubeShaderProgram) {
|
||||
cubeShaderProgram_ = _cubeShaderProgram;
|
||||
}
|
||||
|
||||
void Raycaster::SetQuadShaderProgram(ShaderProgram *_quadShaderProgram) {
|
||||
void Raycaster::SetQuadShaderProgram(ghoul::opengl::ProgramObject *_quadShaderProgram) {
|
||||
quadShaderProgram_ = _quadShaderProgram;
|
||||
}
|
||||
|
||||
bool Raycaster::ReloadShaders() {
|
||||
glGetError();
|
||||
INFO("Reloading shaders");
|
||||
if (!cubeShaderProgram_->DeleteShaders()) return false;
|
||||
if (!quadShaderProgram_->DeleteShaders()) return false;
|
||||
if (!cubeShaderProgram_->Reload()) return false;
|
||||
if (!quadShaderProgram_->Reload()) return false;
|
||||
INFO("Reloading shaders");
|
||||
if (!cubeShaderProgram_->rebuildFromFile()) return false;
|
||||
if (!quadShaderProgram_->rebuildFromFile()) return false;
|
||||
CheckGLError("ReloadShaders()");
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -18,11 +18,11 @@ TODO: Iteratively break away parts from it into other classes.
|
||||
#include <boost/timer/timer.hpp>
|
||||
#include <flare/TSP.h>
|
||||
|
||||
#include <ghoul/opengl/programobject.h>
|
||||
#include <ghoul/opengl/texture.h>
|
||||
|
||||
namespace osp {
|
||||
|
||||
class ShaderProgram;
|
||||
class Texture2D;
|
||||
class Texture3D;
|
||||
class TransferFunction;
|
||||
class Animator;
|
||||
class BrickManager;
|
||||
@@ -60,7 +60,7 @@ public:
|
||||
// Update matrices with current view parameters
|
||||
bool UpdateMatrices();
|
||||
// Bind transformation matrices to a ShaderProgram
|
||||
bool BindTransformationMatrices(ShaderProgram *_program);
|
||||
bool BindTransformationMatrices(ghoul::opengl::ProgramObject *_program);
|
||||
// Read kernel config from file and voxel data,
|
||||
// update the constants that get sent to the kernel every frame
|
||||
bool UpdateKernelConfig();
|
||||
@@ -70,16 +70,16 @@ public:
|
||||
// TODO Actually support and make use of multiple TFs
|
||||
void AddTransferFunction(TransferFunction *_transferFunction);
|
||||
|
||||
Texture2D * CubeFrontTexture() const { return cubeFrontTex_; }
|
||||
Texture2D * CubeBackTexture() const { return cubeBackTex_; }
|
||||
Texture2D * QuadTexture() const { return quadTex_; }
|
||||
ghoul::opengl::Texture * CubeFrontTexture() const { return cubeFrontTex_; }
|
||||
ghoul::opengl::Texture * CubeBackTexture() const { return cubeBackTex_; }
|
||||
ghoul::opengl::Texture * QuadTexture() const { return quadTex_; }
|
||||
|
||||
void SetKernelConfigFilename(const std::string &_filename);
|
||||
void SetCubeFrontTexture(Texture2D *_cubeFrontTexture);
|
||||
void SetCubeBackTexture(Texture2D *_cubeBackTexture);
|
||||
void SetQuadTexture(Texture2D *_quadTexture);
|
||||
void SetCubeShaderProgram(ShaderProgram *_cubeShaderProgram);
|
||||
void SetQuadShaderProgram(ShaderProgram *_quadShaderProgram);
|
||||
void SetCubeFrontTexture(ghoul::opengl::Texture *_cubeFrontTexture);
|
||||
void SetCubeBackTexture(ghoul::opengl::Texture *_cubeBackTexture);
|
||||
void SetQuadTexture(ghoul::opengl::Texture *_quadTexture);
|
||||
void SetCubeShaderProgram(ghoul::opengl::ProgramObject *_cubeShaderProgram);
|
||||
void SetQuadShaderProgram(ghoul::opengl::ProgramObject *_quadShaderProgram);
|
||||
void SetAnimator(Animator *_animator);
|
||||
void SetCLManager(CLManager *_clManager);
|
||||
void SetBrickManager(BrickManager *_brickManager);
|
||||
@@ -108,13 +108,13 @@ private:
|
||||
unsigned int cubePositionAttrib_;
|
||||
unsigned int quadPositionAttrib_;
|
||||
// Shaders
|
||||
ShaderProgram *cubeShaderProgram_;
|
||||
ShaderProgram *quadShaderProgram_;
|
||||
ghoul::opengl::ProgramObject *cubeShaderProgram_;
|
||||
ghoul::opengl::ProgramObject *quadShaderProgram_;
|
||||
// Textures
|
||||
Texture2D *cubeFrontTex_;
|
||||
Texture2D *cubeBackTex_;
|
||||
Texture2D *quadTex_;
|
||||
Texture3D *volumeTex_;
|
||||
ghoul::opengl::Texture *cubeFrontTex_;
|
||||
ghoul::opengl::Texture *cubeBackTex_;
|
||||
ghoul::opengl::Texture *quadTex_;
|
||||
ghoul::opengl::Texture *volumeTex_;
|
||||
// Model params
|
||||
float pitch_;
|
||||
float yaw_;
|
||||
|
||||
@@ -21,7 +21,7 @@ TransferFunction * TransferFunction::New() {
|
||||
}
|
||||
|
||||
TransferFunction::TransferFunction() :
|
||||
texture_(NULL),
|
||||
texture_(nullptr),
|
||||
floatData_(NULL),
|
||||
width_(0),
|
||||
lower_(0.f),
|
||||
@@ -203,8 +203,10 @@ bool TransferFunction::ConstructTexture() {
|
||||
std::vector<unsigned int> dim(2);
|
||||
dim[0] = width_;
|
||||
dim[1] = 1;
|
||||
texture_ = Texture2D::New(dim);
|
||||
texture_->Init(&floatData_[0]);
|
||||
texture_ = new ghoul::opengl::Texture(floatData_, glm::size3_t(width_,1,1),ghoul::opengl::Texture::Format::RGBA, GL_RGBA, GL_FLOAT);
|
||||
texture_->uploadTexture();
|
||||
//texture_ = Texture2D::New(dim);
|
||||
//texture_->Init(&floatData_[0]);
|
||||
generatedTexture_ = true;
|
||||
|
||||
//delete[] values;
|
||||
|
||||
@@ -13,10 +13,10 @@ TODO Use Texture1D for implementation when OpenCL 1.2 is supported
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <ghoul/opengl/texture.h>
|
||||
|
||||
namespace osp {
|
||||
|
||||
class Texture2D;
|
||||
|
||||
class TransferFunction {
|
||||
public:
|
||||
@@ -48,7 +48,7 @@ public:
|
||||
|
||||
// Accessors
|
||||
unsigned int Width() const { return width_; }
|
||||
Texture2D * Texture() { return texture_; }
|
||||
ghoul::opengl::Texture * Texture() { return texture_; }
|
||||
|
||||
// TODO temp
|
||||
float * FloatData() { return floatData_; }
|
||||
@@ -61,7 +61,7 @@ private:
|
||||
TransferFunction(const TransferFunction &_tf);
|
||||
float *floatData_;
|
||||
|
||||
Texture2D *texture_;
|
||||
ghoul::opengl::Texture *texture_;
|
||||
unsigned int width_;
|
||||
float lower_;
|
||||
float upper_;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include <flare/flare.h>
|
||||
|
||||
#include <ghoul/opengl/texture.h>
|
||||
|
||||
#include <flare/Renderer.h>
|
||||
#include <flare/Texture.h>
|
||||
#include <flare/Texture2D.h>
|
||||
@@ -170,7 +172,49 @@ void Flare::init() {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
using ghoul::opengl::ShaderObject;
|
||||
using ghoul::opengl::ProgramObject;
|
||||
|
||||
ProgramObject* cubeShaderProgram = nullptr;
|
||||
ShaderObject* cubeShaderProgram_vs = new ShaderObject(ShaderObject::ShaderType::ShaderTypeVertex,
|
||||
_config->CubeShaderVertFilename(),
|
||||
"cubeShaderProgram_vs"
|
||||
);
|
||||
ShaderObject* cubeShaderProgram_fs = new ShaderObject(ShaderObject::ShaderType::ShaderTypeFragment,
|
||||
_config->CubeShaderFragFilename(),
|
||||
"cubeShaderProgram_fs"
|
||||
);
|
||||
|
||||
cubeShaderProgram = new ProgramObject;
|
||||
cubeShaderProgram->attachObject(cubeShaderProgram_vs);
|
||||
cubeShaderProgram->attachObject(cubeShaderProgram_fs);
|
||||
|
||||
if( ! cubeShaderProgram->compileShaderObjects())
|
||||
LDEBUG("Could not compile cubeShaderProgram");
|
||||
if( ! cubeShaderProgram->linkProgramObject())
|
||||
LDEBUG("Could not link cubeShaderProgram");
|
||||
|
||||
ProgramObject* quadShaderProgram = nullptr;
|
||||
ShaderObject* quadShaderProgram_vs = new ShaderObject(ShaderObject::ShaderType::ShaderTypeVertex,
|
||||
_config->QuadShaderVertFilename(),
|
||||
"quadShaderProgram_vs"
|
||||
);
|
||||
ShaderObject* quadShaderProgram_fs = new ShaderObject(ShaderObject::ShaderType::ShaderTypeFragment,
|
||||
_config->QuadShaderFragFilename(),
|
||||
"quadShaderProgram_fs"
|
||||
);
|
||||
|
||||
quadShaderProgram = new ProgramObject;
|
||||
quadShaderProgram->attachObject(quadShaderProgram_vs);
|
||||
quadShaderProgram->attachObject(quadShaderProgram_fs);
|
||||
|
||||
if( ! quadShaderProgram->compileShaderObjects())
|
||||
LDEBUG("Could not compile quadShaderProgram");
|
||||
if( ! quadShaderProgram->linkProgramObject())
|
||||
LDEBUG("Could not link quadShaderProgram");
|
||||
|
||||
// Create shaders for color cube and output textured quad
|
||||
/*
|
||||
ShaderProgram *cubeShaderProgram = ShaderProgram::New();
|
||||
cubeShaderProgram->CreateShader(ShaderProgram::VERTEX,
|
||||
_config->CubeShaderVertFilename());
|
||||
@@ -184,19 +228,31 @@ void Flare::init() {
|
||||
quadShaderProgram->CreateShader(ShaderProgram::FRAGMENT,
|
||||
_config->QuadShaderFragFilename());
|
||||
quadShaderProgram->CreateProgram();
|
||||
*/
|
||||
|
||||
// Create two textures to hold the color cube
|
||||
std::vector<unsigned int> dimensions(2);
|
||||
dimensions[0] = width;
|
||||
dimensions[1] = height;
|
||||
ghoul::opengl::Texture* cubeFrontTex = new ghoul::opengl::Texture(glm::size3_t(width, height, 1),
|
||||
ghoul::opengl::Texture::Format::RGBA, GL_RGBA, GL_FLOAT);
|
||||
cubeFrontTex->uploadTexture();
|
||||
ghoul::opengl::Texture* cubeBackTex = new ghoul::opengl::Texture(glm::size3_t(width, height, 1),
|
||||
ghoul::opengl::Texture::Format::RGBA, GL_RGBA, GL_FLOAT);
|
||||
cubeBackTex->uploadTexture();
|
||||
/*
|
||||
Texture2D *cubeFrontTex = Texture2D::New(dimensions);
|
||||
Texture2D *cubeBackTex = Texture2D::New(dimensions);
|
||||
cubeFrontTex->Init();
|
||||
cubeBackTex->Init();
|
||||
|
||||
*/
|
||||
// Create an output texture to write to
|
||||
Texture2D *quadTex = Texture2D::New(dimensions);
|
||||
quadTex->Init();
|
||||
ghoul::opengl::Texture* quadTex = new ghoul::opengl::Texture(glm::size3_t(width, height, 1),
|
||||
ghoul::opengl::Texture::Format::RGBA, GL_RGBA, GL_FLOAT);
|
||||
quadTex->uploadTexture();
|
||||
|
||||
//Texture2D *quadTex = Texture2D::New(dimensions);
|
||||
//quadTex->Init();
|
||||
|
||||
// Create transfer functions
|
||||
TransferFunction *transferFunction = TransferFunction::New();
|
||||
|
||||
Reference in New Issue
Block a user