Commit c1b3f018 authored by Martin Schultz's avatar Martin Schultz
Browse files

removed ARB texture buffer ifdefs, since checking at compile time is not an...

removed ARB texture buffer ifdefs, since checking at compile time is not an option for coreprofile contexts, also discard checking for this extension entirely, compatibility contexts should stick to opengl version 2.1
parent 681956a6
...@@ -125,12 +125,10 @@ MSFilterWeights::MSFilterWeights(int _numSamples) : numSamples_(_numSamples) { ...@@ -125,12 +125,10 @@ MSFilterWeights::MSFilterWeights(int _numSamples) : numSamples_(_numSamples) {
} }
//============================================================================= //=============================================================================
#if defined(GL_ARB_texture_buffer_object)
void MSFilterWeights::asTextureBuffer( TextureBuffer& out ) { void MSFilterWeights::asTextureBuffer( TextureBuffer& out ) {
if (numSamples_) if (numSamples_)
out.setBufferData(numSamples_ * 4, &weights_[0], GL_R32F, GL_STATIC_DRAW); out.setBufferData(numSamples_ * 4, &weights_[0], GL_R32F, GL_STATIC_DRAW);
} }
#endif
//============================================================================= //=============================================================================
#endif //MSFILTERWEIGHTS #endif //MSFILTERWEIGHTS
......
...@@ -117,13 +117,11 @@ public: ...@@ -117,13 +117,11 @@ public:
virtual ~MSFilterWeights() { } virtual ~MSFilterWeights() { }
#if defined(GL_ARB_texture_buffer_object)
// Initializes a texture buffer with filter weights in format GL_R32F. // Initializes a texture buffer with filter weights in format GL_R32F.
// This can be used for reading from multisampled textures in a shader. // This can be used for reading from multisampled textures in a shader.
void asTextureBuffer(TextureBuffer& out); void asTextureBuffer(TextureBuffer& out);
#endif
// get ptr to weights as array, can be used for setUniform() for example // get ptr to weights as array, can be used for setUniform() for example
const float* asDataPtr() const {return &weights_[0];} const float* asDataPtr() const {return &weights_[0];}
......
...@@ -488,7 +488,6 @@ public: ...@@ -488,7 +488,6 @@ public:
*/ */
void updatePickingVertices_opt(ACG::GLState& _state); void updatePickingVertices_opt(ACG::GLState& _state);
#ifdef GL_ARB_texture_buffer_object
TextureBuffer* pickVertexMap_opt(){ TextureBuffer* pickVertexMap_opt(){
if ( pickVertexMapTBO_.is_valid() ) if ( pickVertexMapTBO_.is_valid() )
...@@ -499,7 +498,6 @@ public: ...@@ -499,7 +498,6 @@ public:
} }
} }
#endif // GL_ARB_texture_buffer_object
private: private:
...@@ -509,10 +507,8 @@ private: ...@@ -509,10 +507,8 @@ private:
std::vector< ACG::Vec4uc > pickVertColBuf_; std::vector< ACG::Vec4uc > pickVertColBuf_;
#ifdef GL_ARB_texture_buffer_object
// map from vbo vertex id to openmesh vertex id // map from vbo vertex id to openmesh vertex id
TextureBuffer pickVertexMapTBO_; TextureBuffer pickVertexMapTBO_;
#endif // GL_ARB_texture_buffer_object
// vertex picking shader // vertex picking shader
GLSL::Program* pickVertexShader_; GLSL::Program* pickVertexShader_;
...@@ -642,7 +638,6 @@ public: ...@@ -642,7 +638,6 @@ public:
*/ */
void updatePickingFaces_opt(ACG::GLState& _state ); void updatePickingFaces_opt(ACG::GLState& _state );
#ifdef GL_ARB_texture_buffer_object
TextureBuffer* pickFaceTriangleMap_opt(){ TextureBuffer* pickFaceTriangleMap_opt(){
if ( pickFaceTriToFaceMapTBO_.is_valid() ) if ( pickFaceTriToFaceMapTBO_.is_valid() )
...@@ -652,7 +647,6 @@ public: ...@@ -652,7 +647,6 @@ public:
return 0; return 0;
} }
} }
#endif
private: private:
...@@ -660,10 +654,8 @@ private: ...@@ -660,10 +654,8 @@ private:
std::vector< ACG::Vec3f > pickFaceVertexBuf_; std::vector< ACG::Vec3f > pickFaceVertexBuf_;
std::vector< ACG::Vec4uc > pickFaceColBuf_; std::vector< ACG::Vec4uc > pickFaceColBuf_;
#ifdef GL_ARB_texture_buffer_object
// optimized picking with shaders: maps from triangle id in draw vbo to face id in openmesh // optimized picking with shaders: maps from triangle id in draw vbo to face id in openmesh
TextureBuffer pickFaceTriToFaceMapTBO_; TextureBuffer pickFaceTriToFaceMapTBO_;
#endif // GL_ARB_texture_buffer_object
/// optimized face picking shader /// optimized face picking shader
GLSL::Program* pickFaceShader_; GLSL::Program* pickFaceShader_;
......
...@@ -1621,9 +1621,8 @@ void DrawMeshT<Mesh>::updatePickingVertices_opt(ACG::GLState& _state) ...@@ -1621,9 +1621,8 @@ void DrawMeshT<Mesh>::updatePickingVertices_opt(ACG::GLState& _state)
rebuild(); rebuild();
} }
#ifndef GL_ARB_texture_buffer_object if(ACG::compatibilityProfile())
pickVertexMethod_ = 1; // no texture buffers supported during compilation pickVertexMethod_ = 1; // no texture buffers supported during compilation
#endif
if (numVerts_) if (numVerts_)
{ {
...@@ -1631,7 +1630,8 @@ void DrawMeshT<Mesh>::updatePickingVertices_opt(ACG::GLState& _state) ...@@ -1631,7 +1630,8 @@ void DrawMeshT<Mesh>::updatePickingVertices_opt(ACG::GLState& _state)
if (pickVertexMethod_ == 0) if (pickVertexMethod_ == 0)
{ {
#ifdef GL_ARB_texture_buffer_object if(!ACG::compatibilityProfile())
{
std::vector<int> forwardMap(numVerts_, 0); std::vector<int> forwardMap(numVerts_, 0);
...@@ -1642,8 +1642,7 @@ void DrawMeshT<Mesh>::updatePickingVertices_opt(ACG::GLState& _state) ...@@ -1642,8 +1642,7 @@ void DrawMeshT<Mesh>::updatePickingVertices_opt(ACG::GLState& _state)
forwardMap[vboIdx] = i; forwardMap[vboIdx] = i;
} }
pickVertexMapTBO_.setBufferData(sizeof(int) * numVerts_, &forwardMap[0], GL_R32I, GL_STATIC_DRAW); pickVertexMapTBO_.setBufferData(sizeof(int) * numVerts_, &forwardMap[0], GL_R32I, GL_STATIC_DRAW);
}
#endif // GL_ARB_texture_buffer_object
} }
else else
...@@ -1729,9 +1728,8 @@ void ACG::DrawMeshT<Mesh>::drawPickingVertices_opt( const GLMatrixf& _mvp, size_ ...@@ -1729,9 +1728,8 @@ void ACG::DrawMeshT<Mesh>::drawPickingVertices_opt( const GLMatrixf& _mvp, size_
if (pickVertexMethod_ == 0) if (pickVertexMethod_ == 0)
{ {
pickVertexShader_->setUniform("vboToInputMap", 0); pickVertexShader_->setUniform("vboToInputMap", 0);
#ifdef GL_ARB_texture_buffer_object if(!ACG::compatibilityProfile())
pickVertexMap_opt()->bind(GL_TEXTURE0); pickVertexMap_opt()->bind(GL_TEXTURE0);
#endif
} }
pickVertexShader_->setUniform("mWVP", _mvp); pickVertexShader_->setUniform("mWVP", _mvp);
...@@ -2065,13 +2063,11 @@ void DrawMeshT<Mesh>::updatePickingFaces_opt(ACG::GLState& _state ) ...@@ -2065,13 +2063,11 @@ void DrawMeshT<Mesh>::updatePickingFaces_opt(ACG::GLState& _state )
rebuild(); rebuild();
} }
#ifdef GL_ARB_texture_buffer_object if (!ACG::compatibilityProfile() && meshComp_ && meshComp_->getNumTriangles())
if (meshComp_ && meshComp_->getNumTriangles())
{ {
// upload tri->face lookup-table to texture buffer // upload tri->face lookup-table to texture buffer
pickFaceTriToFaceMapTBO_.setBufferData(sizeof(int) * meshComp_->getNumTriangles(), meshComp_->mapToOriginalFaceIDPtr(), GL_R32I, GL_STATIC_DRAW); pickFaceTriToFaceMapTBO_.setBufferData(sizeof(int) * meshComp_->getNumTriangles(), meshComp_->mapToOriginalFaceIDPtr(), GL_R32I, GL_STATIC_DRAW);
} }
#endif // GL_ARB_texture_buffer_object
} }
...@@ -2140,9 +2136,8 @@ void ACG::DrawMeshT<Mesh>::drawPickingFaces_opt( const GLMatrixf& _mvp, size_t _ ...@@ -2140,9 +2136,8 @@ void ACG::DrawMeshT<Mesh>::drawPickingFaces_opt( const GLMatrixf& _mvp, size_t _
pickFaceShader_->setUniform("pickFaceOffset", static_cast<GLint>(_pickOffset)); pickFaceShader_->setUniform("pickFaceOffset", static_cast<GLint>(_pickOffset));
pickFaceShader_->setUniform("triToFaceMap", 0); pickFaceShader_->setUniform("triToFaceMap", 0);
#ifdef GL_ARB_texture_buffer_object if(!ACG::compatibilityProfile())
pickFaceTriangleMap_opt()->bind(GL_TEXTURE0); pickFaceTriangleMap_opt()->bind(GL_TEXTURE0);
#endif
pickFaceShader_->setUniform("mWVP", _mvp); pickFaceShader_->setUniform("mWVP", _mvp);
......
...@@ -1802,9 +1802,7 @@ int GLState::getBufferTargetIndex(GLenum _target) ...@@ -1802,9 +1802,7 @@ int GLState::getBufferTargetIndex(GLenum _target)
#ifdef GL_ARB_query_buffer_object #ifdef GL_ARB_query_buffer_object
case GL_QUERY_BUFFER: return 11; case GL_QUERY_BUFFER: return 11;
#endif #endif
#ifdef GL_ARB_texture_buffer_object
case GL_TEXTURE_BUFFER: return 12; case GL_TEXTURE_BUFFER: return 12;
#endif
#ifdef GL_VERSION_3_0 #ifdef GL_VERSION_3_0
case GL_TRANSFORM_FEEDBACK_BUFFER: return 13; case GL_TRANSFORM_FEEDBACK_BUFFER: return 13;
#endif #endif
......
...@@ -170,10 +170,8 @@ void IRenderer::addRenderObject(ACG::RenderObject* _renderObject) ...@@ -170,10 +170,8 @@ void IRenderer::addRenderObject(ACG::RenderObject* _renderObject)
for (std::map<size_t,RenderObject::Texture>::const_iterator it = _renderObject->textures().begin(); for (std::map<size_t,RenderObject::Texture>::const_iterator it = _renderObject->textures().begin();
it != _renderObject->textures().end(); ++it) it != _renderObject->textures().end(); ++it)
{ {
#ifdef GL_ARB_texture_buffer_object
if (it->second.type == GL_TEXTURE_BUFFER) if (it->second.type == GL_TEXTURE_BUFFER)
continue; // skip texture buffers, for which testing for mipmaps would generate an error continue; // skip texture buffers, for which testing for mipmaps would generate an error
#endif
glBindTexture(it->second.type, it->second.id); glBindTexture(it->second.type, it->second.id);
......
...@@ -48,6 +48,7 @@ ...@@ -48,6 +48,7 @@
\*===========================================================================*/ \*===========================================================================*/
#include "ShaderGenerator.hh" #include "ShaderGenerator.hh"
#include <ACG/GL/acg_glew.hh>
#include <cstdio> #include <cstdio>
#include <iostream> #include <iostream>
...@@ -1716,9 +1717,7 @@ void ShaderProgGenerator::buildFragmentShader() ...@@ -1716,9 +1717,7 @@ void ShaderProgGenerator::buildFragmentShader()
#ifdef GL_ARB_texture_rectangle //ARCH_DARWIN doesn't support all texture defines with all xcode version (xcode 5.0 seems to support all) #ifdef GL_ARB_texture_rectangle //ARCH_DARWIN doesn't support all texture defines with all xcode version (xcode 5.0 seems to support all)
case GL_TEXTURE_RECTANGLE_ARB: type = "sampler2DRect"; break; case GL_TEXTURE_RECTANGLE_ARB: type = "sampler2DRect"; break;
#endif #endif
#ifdef GL_ARB_texture_buffer_object case GL_TEXTURE_BUFFER: type = "samplerBuffer"; break;
case GL_TEXTURE_BUFFER_ARB: type = "samplerBuffer"; break;
#endif
#ifdef GL_EXT_texture_array #ifdef GL_EXT_texture_array
case GL_TEXTURE_1D_ARRAY_EXT: type = "sampler1DArray"; break; case GL_TEXTURE_1D_ARRAY_EXT: type = "sampler1DArray"; break;
case GL_TEXTURE_2D_ARRAY_EXT: type = "sampler2DArray"; break; case GL_TEXTURE_2D_ARRAY_EXT: type = "sampler2DArray"; break;
...@@ -2780,9 +2779,7 @@ QString ShaderGenDesc::toString() const ...@@ -2780,9 +2779,7 @@ QString ShaderGenDesc::toString() const
#ifdef GL_ARB_texture_rectangle //ARCH_DARWIN doesn't support all texture defines with all xcode version (xcode 5.0 seems to support all) #ifdef GL_ARB_texture_rectangle //ARCH_DARWIN doesn't support all texture defines with all xcode version (xcode 5.0 seems to support all)
case GL_TEXTURE_RECTANGLE_ARB: resStrm << "GL_TEXTURE_RECTANGLE"; break; case GL_TEXTURE_RECTANGLE_ARB: resStrm << "GL_TEXTURE_RECTANGLE"; break;
#endif #endif
#ifdef GL_ARB_texture_buffer_object case GL_TEXTURE_BUFFER: resStrm << "GL_TEXTURE_BUFFER"; break;
case GL_TEXTURE_BUFFER_ARB: resStrm << "GL_TEXTURE_BUFFER"; break;
#endif
#ifdef GL_EXT_texture_array #ifdef GL_EXT_texture_array
case GL_TEXTURE_1D_ARRAY_EXT: resStrm << "GL_TEXTURE_1D_ARRAY"; break; case GL_TEXTURE_1D_ARRAY_EXT: resStrm << "GL_TEXTURE_1D_ARRAY"; break;
case GL_TEXTURE_2D_ARRAY_EXT: resStrm << "GL_TEXTURE_2D_ARRAY"; break; case GL_TEXTURE_2D_ARRAY_EXT: resStrm << "GL_TEXTURE_2D_ARRAY"; break;
......
...@@ -781,11 +781,7 @@ int VertexBufferObject::size() { ...@@ -781,11 +781,7 @@ int VertexBufferObject::size() {
TextureBuffer::TextureBuffer(GLenum u) TextureBuffer::TextureBuffer(GLenum u)
: :
#if defined(GL_ARB_texture_buffer_object)
Texture(GL_TEXTURE_BUFFER, u), Texture(GL_TEXTURE_BUFFER, u),
#else
Texture(0, u),
#endif
bufferSize_(0), buffer_(0), usage_(0), fmt_(0) { bufferSize_(0), buffer_(0), usage_(0), fmt_(0) {
} }
...@@ -797,7 +793,8 @@ TextureBuffer::~TextureBuffer() { ...@@ -797,7 +793,8 @@ TextureBuffer::~TextureBuffer() {
void TextureBuffer::setBufferData( void TextureBuffer::setBufferData(
size_t _size, const void* _data, GLenum _internalFormat, GLenum _usage) { size_t _size, const void* _data, GLenum _internalFormat, GLenum _usage) {
#if defined(GL_ARB_texture_buffer_object) if(!ACG::compatibilityProfile())
{
if (supportsTextureBuffer()) { if (supportsTextureBuffer()) {
// setup buffer object // setup buffer object
if (!buffer_) if (!buffer_)
...@@ -821,13 +818,14 @@ void TextureBuffer::setBufferData( ...@@ -821,13 +818,14 @@ void TextureBuffer::setBufferData(
} }
else else
std::cerr << "TextureBuffer::setData - gpu does not support buffer textures!" << std::endl; std::cerr << "TextureBuffer::setData - gpu does not support buffer textures!" << std::endl;
#else } else{
std::cerr << "TextureBuffer::setData - glew version too old, rebuild with latest glew!" << std::endl; std::cerr << "TextureBuffer::setData - currently only in core profile available!" << std::endl;
#endif }
} }
bool TextureBuffer::getBufferData(void* _dst) { bool TextureBuffer::getBufferData(void* _dst) {
#if defined(GL_ARB_texture_buffer_object) if(!ACG::compatibilityProfile())
{
if (buffer_) { if (buffer_) {
glBindBuffer(GL_TEXTURE_BUFFER, buffer_); glBindBuffer(GL_TEXTURE_BUFFER, buffer_);
glGetBufferSubData(GL_TEXTURE_BUFFER, 0, bufferSize_, _dst); glGetBufferSubData(GL_TEXTURE_BUFFER, 0, bufferSize_, _dst);
...@@ -835,9 +833,9 @@ bool TextureBuffer::getBufferData(void* _dst) { ...@@ -835,9 +833,9 @@ bool TextureBuffer::getBufferData(void* _dst) {
} }
else else
std::cerr << "TextureBuffer::getBufferData - gpu does not support buffer textures!" << std::endl; std::cerr << "TextureBuffer::getBufferData - gpu does not support buffer textures!" << std::endl;
#else }else{
std::cerr << "TextureBuffer::getBufferData - glew version too old, rebuild with latest glew!" << std::endl; std::cerr << "TextureBuffer::getBufferData - currently only in core profile available!" << std::endl;
#endif }
return false; return false;
} }
......
...@@ -78,8 +78,8 @@ void MeshNodeBase::supplyDrawMesh(DrawMeshBase *drawMeshBase) { ...@@ -78,8 +78,8 @@ void MeshNodeBase::supplyDrawMesh(DrawMeshBase *drawMeshBase) {
void MeshNodeBase::updatePolyEdgeBuf() void MeshNodeBase::updatePolyEdgeBuf()
{ {
if(!ACG::compatibilityProfile())
#ifdef GL_ARB_texture_buffer_object {
// drawMeshBase_ must have been supplied. // drawMeshBase_ must have been supplied.
assert(drawMeshBase_); assert(drawMeshBase_);
...@@ -147,7 +147,7 @@ void MeshNodeBase::updatePolyEdgeBuf() ...@@ -147,7 +147,7 @@ void MeshNodeBase::updatePolyEdgeBuf()
ACG::glCheckErrors(); ACG::glCheckErrors();
} }
} }
#endif }
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment