Removed unused files

This commit is contained in:
Jonas Strandstedt
2014-10-23 14:35:04 +02:00
parent a7da4d84cc
commit 5e410c6816
20 changed files with 0 additions and 2555 deletions
@@ -1,37 +0,0 @@
#ifndef RENDERABLEBODY_H
#define RENDERABLEBODY_H
// open space includes
#include <openspace/rendering/renderable.h>
#include <openspace/util/sphere.h>
// ghoul includes
#include "ghoul/opengl/programobject.h"
#include "ghoul/opengl/texture.h"
namespace openspace {
/*
class RenderableBody: public Renderable {
public:
// constructors & destructor
RenderableBody(const pss &radius);
~RenderableBody();
void setProgramObject(ghoul::opengl::ProgramObject *programObject);
void setTexture(ghoul::opengl::Texture *texture);
virtual void render(const Camera *camera, const psc &thisPosition);
virtual void update();
private:
ghoul::opengl::ProgramObject *programObject_;
ghoul::opengl::Texture *texture_;
double rad_;
gl4::Sphere *planet_;
};
*/
} // namespace openspace
#endif
@@ -1,106 +0,0 @@
// This is still in the repository to be cannibalized for a possible rewrite (ab)
///*****************************************************************************************
// * *
// * OpenSpace *
// * *
// * Copyright (c) 2014 *
// * *
// * Permission is hereby granted, free of charge, to any person obtaining a copy of this *
// * software and associated documentation files (the "Software"), to deal in the Software *
// * without restriction, including without limitation the rights to use, copy, modify, *
// * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
// * permit persons to whom the Software is furnished to do so, subject to the following *
// * conditions: *
// * *
// * The above copyright notice and this permission notice shall be included in all copies *
// * or substantial portions of the Software. *
// * *
// * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
// * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
// * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
// * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
// * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
// * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
// ****************************************************************************************/
//
//#ifndef __RENDERABLEVOLUMECL_H__
//#define __RENDERABLEVOLUMECL_H__
//
//// open space includes
//#include <openspace/rendering/renderablevolume.h>
//
//// ghoul includes
//#include <ghoul/opengl/programobject.h>
//#include <ghoul/opengl/texture.h>
//#include <ghoul/opengl/framebufferobject.h>
//#include <ghoul/opencl/clcontext.h>
//#include <ghoul/opencl/clcommandqueue.h>
//#include <ghoul/opencl/clprogram.h>
//#include <ghoul/opencl/clkernel.h>
//#include <ghoul/opencl/clworksize.h>
//#include <ghoul/io/rawvolumereader.h>
//#include <ghoul/filesystem/file.h>
//
//#define SGCT_WINDOWS_INCLUDE
//#include <sgct.h>
//
//namespace sgct_utils {
// class SGCTBox;
//}
//
////#include <vector>
////#include <string>
//#ifdef __APPLE__
// #include <memory>
//#else
// #include <mutex>
//#endif
//
//namespace openspace {
//
//class RenderableVolumeCL: public RenderableVolume {
//public:
//
// // constructors & destructor
// RenderableVolumeCL(const ghoul::Dictionary& dictionary);
// ~RenderableVolumeCL();
//
// bool initialize();
// bool deinitialize();
//
// virtual void render(const Camera *camera, const psc& thisPosition);
// virtual void update();
//
//private:
//
// void safeKernelCompilation();
//
// std::string _filename;
// ghoul::RawVolumeReader::ReadHints _hints;
// float _stepSize;
// ghoul::opengl::FramebufferObject* _fbo;
// ghoul::opengl::Texture* _backTexture;
// ghoul::opengl::Texture* _frontTexture;
// ghoul::opengl::Texture* _volume;
// ghoul::opengl::Texture* _output;
// ghoul::opengl::ProgramObject *_fboProgram;
// ghoul::opengl::ProgramObject *_quadProgram;
// sgct_utils::SGCTBox* _boundingBox;
// GLuint _screenQuad;
//
// ghoul::opencl::CLContext _context;
// ghoul::opencl::CLCommandQueue _commands;
// ghoul::opencl::CLProgram _program;
// ghoul::opencl::CLKernel _kernel;
// ghoul::opencl::CLWorkSize* _ws;
// cl_mem _clBackTexture, _clFrontTexture, _clVolume, _clOutput;
//
// ghoul::filesystem::File* _kernelSourceFile;
// bool _kernelUpdateOnSave;
// std::mutex* _kernelMutex;
//
//};
//
//} // namespace openspace
//
//#endif
@@ -1,119 +0,0 @@
// This is still in the repository to be cannibalized for a possible rewrite (ab)
///*****************************************************************************************
// * *
// * OpenSpace *
// * *
// * Copyright (c) 2014 *
// * *
// * Permission is hereby granted, free of charge, to any person obtaining a copy of this *
// * software and associated documentation files (the "Software"), to deal in the Software *
// * without restriction, including without limitation the rights to use, copy, modify, *
// * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
// * permit persons to whom the Software is furnished to do so, subject to the following *
// * conditions: *
// * *
// * The above copyright notice and this permission notice shall be included in all copies *
// * or substantial portions of the Software. *
// * *
// * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
// * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
// * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
// * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
// * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
// * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
// ****************************************************************************************/
//
//#ifndef __RENDERABLEVOLUMEEXPERT_H__
//#define __RENDERABLEVOLUMEEXPERT_H__
//
//// open space includes
//#include <openspace/rendering/renderablevolume.h>
//#include <openspace/rendering/volumeraycasterbox.h>
//
//// ghoul includes
//#include <ghoul/opengl/programobject.h>
//#include <ghoul/opengl/texture.h>
//#include <ghoul/opengl/framebufferobject.h>
//#include <ghoul/opencl/clcontext.h>
//#include <ghoul/opencl/clcommandqueue.h>
//#include <ghoul/opencl/clprogram.h>
//#include <ghoul/opencl/clkernel.h>
//#include <ghoul/filesystem/file.h>
//
//#ifdef __APPLE__
// #include <memory>
//#else
// #include <mutex>
//#endif
//
//namespace ghoul {
// namespace opencl {
// class CLWorkSize;
// }
//}
//
//namespace openspace {
//
//class RenderableVolumeExpert: public RenderableVolume {
//public:
//
// // constructors & destructor
// RenderableVolumeExpert(const ghoul::Dictionary& dictionary);
// ~RenderableVolumeExpert();
//
// bool initialize();
// bool deinitialize();
//
// virtual void render(const Camera *camera, const psc& thisPosition);
// virtual void update();
//
//private:
//
// // private methods
// void safeKernelCompilation();
// void safeUpdateTexture(const ghoul::filesystem::File& file);
//
// // Volumes
// std::vector<std::string> _volumePaths;
// std::vector<ghoul::Dictionary> _volumeHints;
//
// // Textures
// ghoul::opengl::Texture* _output;
// std::vector<ghoul::opengl::Texture*> _volumes;
// std::vector<ghoul::opengl::Texture*> _transferFunctions;
// std::vector<ghoul::filesystem::File*> _transferFunctionsFiles;
//
// // opencl texture memory pointers
// cl_mem _clBackTexture;
// cl_mem _clFrontTexture;
// cl_mem _clOutput;
// std::vector<cl_mem> _clVolumes;
// std::vector<cl_mem> _clTransferFunctions;
//
// // opencl program
// ghoul::opencl::CLContext _context;
// ghoul::opencl::CLCommandQueue _commands;
// ghoul::opencl::CLProgram _program;
// ghoul::opencl::CLKernel _kernel;
// ghoul::opencl::CLWorkSize* _ws;
// ghoul::filesystem::File* _kernelSourceFile;
// std::vector<std::pair<ghoul::opencl::CLProgram::Option, bool> > _kernelOptions;
// std::vector<std::string> _kernelIncludes;
// std::vector<std::pair<std::string,std::string> > _kernelDefinitions;
// bool _programUpdateOnSave;
//
// // mutexes to prevent inconsistencies
// std::mutex* _kernelLock;
// std::mutex* _textureLock;
//
// ghoul::opengl::ProgramObject *_quadProgram;
// GLuint _screenQuad;
//
// VolumeRaycasterBox* _colorBoxRenderer;
// glm::vec3 _boxScaling;
//
//};
//
//} // namespace openspace
//
//#endif
@@ -1,65 +0,0 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
* without restriction, including without limitation the rights to use, copy, modify, *
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
* permit persons to whom the Software is furnished to do so, subject to the following *
* conditions: *
* *
* The above copyright notice and this permission notice shall be included in all copies *
* or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef VOLUMERAYCASTERBOX_H_
#define VOLUMERAYCASTERBOX_H_
#include <ghoul/opengl/texture.h>
// forward declare private objects
namespace sgct_utils {
class SGCTBox;
}
namespace ghoul {
namespace opengl {
class FramebufferObject;
class ProgramObject;
}
}
namespace openspace {
class VolumeRaycasterBox {
public:
VolumeRaycasterBox();
~VolumeRaycasterBox();
bool initialize();
void render(const glm::mat4& MVP, const glm::mat4& transform = glm::mat4(1.0), int type = 0);
ghoul::opengl::Texture* backFace();
ghoul::opengl::Texture* frontFace();
glm::size2_t dimensions();
private:
ghoul::opengl::FramebufferObject* _fbo;
ghoul::opengl::Texture *_backTexture, *_frontTexture;
ghoul::opengl::ProgramObject *_boxProgram;
sgct_utils::SGCTBox* _boundingBox;
GLint _MVPLocation, _modelTransformLocation, _typeLocation;
glm::size2_t _dimensions;
};
} // namespace openspace
#endif // VOLUMERAYCASTERBOX_H_
@@ -1,62 +0,0 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
* without restriction, including without limitation the rights to use, copy, modify, *
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
* permit persons to whom the Software is furnished to do so, subject to the following *
* conditions: *
* *
* The above copyright notice and this permission notice shall be included in all copies *
* or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
/*
#ifndef __VOLUMERAYCASTERSINGLEPASS_H__
#define __VOLUMERAYCASTERSINGLEPASS_H__
#include <openspace/rendering/volumeraycaster.h>
#include <ghoul/opengl/programobject.h>
#include <ghoul/opengl/framebufferobject.h>
#include <ghoul/opengl/texture.h>
#include <ghoul/io/rawvolumereader.h>
#include <sgct.h>
namespace openspace {
using namespace ghoul::opengl;
class VolumeRaycasterSinglePass: public VolumeRaycaster {
public:
VolumeRaycasterSinglePass(const ghoul::Dictionary& dictionary);
~VolumeRaycasterSinglePass();
bool initialize();
void render(const glm::mat4& modelViewProjection);
private:
std::string _filename;
ghoul::RawVolumeReader::ReadHints _hints;
//float _stepSize;
Texture* _volume;
ProgramObject *_singlepassProgram;
sgct_utils::SGCTBox* _boundingBox;
GLuint _cubeCenterVBO;
};
} // namespace openspace
#endif // VOLUMERAYCASTER_H
*/
-38
View File
@@ -1,38 +0,0 @@
/**
Copyright (C) 2012-2014 Jonas Strandstedt
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef GEOMETRY_H
#define GEOMETRY_H
// open space includes
#include <openspace/util/vbo.h>
namespace gl4
{
class Geometry : public VBO
{
public:
//initializers
Geometry();
virtual ~Geometry();
virtual void init();
glm::mat4 getTransform();
private:
glm::vec2 _limits[3];
glm::vec3 _position;
glm::mat4 _rotation;
protected:
std::string _texture;
glm::mat4 _transform;
};
}
#endif
-48
View File
@@ -1,48 +0,0 @@
/**
Copyright (C) 2012-2014 Jonas Strandstedt
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef PLANET_H
#define PLANET_H
// open space includes
#include <openspace/util/powerscaledscalar.h>
#include <openspace/util/vbo_template.h>
// std includes
#include <string>
namespace openspace
{
typedef struct
{
GLfloat location[4];
GLfloat tex[2];
GLfloat normal[3];
GLubyte padding[28]; // Pads the struct out to 64 bytes for performance increase
} Vertex;
class Planet
{
public:
//initializers
Planet(PowerScaledScalar radius, int levels = 4);
~Planet();
void setHeightMap(const std::string &path);
void render();
private:
VBO<Vertex> *vbo;
};
} // namespace openspace
#endif
-29
View File
@@ -1,29 +0,0 @@
/**
Copyright (C) 2012-2014 Jonas Strandstedt
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef SPHERE_H
#define SPHERE_H
// open space includes
#include <openspace/util/geometry.h>
namespace gl4
{
class Sphere: public Geometry
{
public:
//initializers
Sphere(float radius = 1.0f, int segments = 8, bool tessellation = false);
~Sphere();
private:
};
}
#endif
-64
View File
@@ -1,64 +0,0 @@
/**
Copyright (C) 2012-2014 Jonas Strandstedt
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef VBO_H
#define VBO_H
// sgct includes
//#include "sgct.h"
#include <ghoul/opengl/opengl>
#define BUFFER_OFFSET(i) ((char *)NULL + (i))
typedef struct
{
GLfloat location[3];
GLfloat tex[2];
GLfloat normal[3];
GLfloat color[4];
GLfloat attribute[3];
GLfloat float_attribute;
//GLubyte padding[4]; // Pads the struct out to 64 bytes for performance increase
} Vertex;
namespace gl4
{
class VBO
{
public:
//initializers
VBO();
~VBO();
// init VBO
virtual void init();
void setProportions(float w, float h) { _w = w; _h = h;};
// render
void render();
private:
GLuint _vaoID;
GLuint _vBufferID;
GLuint _iBufferID;
float _w;
float _h;
protected:
// arrays with all triangles and indices
GLenum _mode;
unsigned int _isize;
unsigned int _vsize;
Vertex *_varray;
int *_iarray;
};
}
#endif
-111
View File
@@ -1,111 +0,0 @@
/**
Copyright (C) 2012-2014 Jonas Strandstedt
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef VBOTEMPLATE_H
#define VBOTEMPLATE_H
// std includes
#include <string>
#include <vector>
#include <tuple>
// sgct includes
#include "ghoul/logging/consolelog.h"
// sgct includes
//#include "sgct.h"
#include <ghoul/opengl/opengl>
#define BUFFER_OFFSET(i) ((char *)NULL + (i))
namespace openspace
{
template<typename T>
class VBO {
public:
//initializers
VBO(const std::vector<std::tuple<int, GLenum, int> > descriptor, T *varray, int vsize, int *iarray, int isize): isize_(isize), vsize_(vsize), descriptor_(descriptor), varray_(varray), iarray_(iarray) {
static_assert(std::is_pod<T>::value, "Template typename should be a POD");
vBufferID_ = 0;
iBufferID_ = 0;
vaoID_ = 0;
}
~VBO() {};
// init VBO
void init() {
//ghoul logging
std::string _loggerCat = "VBO::init";
GLuint errorID = glGetError();
glGenVertexArrays(1, &vaoID_);
// First VAO setup
glBindVertexArray(vaoID_);
glGenBuffers(1, &vBufferID_);
glBindBuffer(GL_ARRAY_BUFFER, vBufferID_);
glBufferData(GL_ARRAY_BUFFER, vsize_*sizeof(T), varray_, GL_STATIC_DRAW);
for(size_t i = 0; i < descriptor_.size(); ++i) {
glVertexAttribPointer(i,std::get<0>(descriptor_.at(i)), std::get<1>(descriptor_.at(i)), GL_FALSE, sizeof(T), BUFFER_OFFSET(std::get<2>(descriptor_.at(i))));
glEnableVertexAttribArray(i);
}
glGenBuffers(1, &iBufferID_);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, iBufferID_);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, isize_*sizeof(int), iarray_, GL_STATIC_DRAW);
if(vBufferID_ == 0) {
LERROR("Vertex buffer not initialized");
}
if(iBufferID_ == 0) {
LERROR("Index buffer not initialized");
}
glBindVertexArray(0);
errorID = glGetError();
if(errorID != GL_NO_ERROR)
{
LERROR("OpenGL error: " << glewGetErrorString(errorID));
LERROR("Attempting to proceed anyway. Expect rendering errors or a crash.");
}
};
// render
void render() {
glBindVertexArray(vaoID_); // select first VAO
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, iBufferID_);
glDrawElements(GL_TRIANGLES, isize_, GL_UNSIGNED_INT, BUFFER_OFFSET(0));
glBindVertexArray(0);
};
private:
GLuint vaoID_;
GLuint vBufferID_;
GLuint iBufferID_;
unsigned int isize_;
unsigned int vsize_;
std::vector<std::tuple<int, GLenum, int> > descriptor_;
T *varray_;
int *iarray_;
};
} // namespace openspace
#endif