Commit c1b3f018 authored by Martin Schultz's avatar Martin Schultz

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) {
}
//=============================================================================
#if defined(GL_ARB_texture_buffer_object)
void MSFilterWeights::asTextureBuffer( TextureBuffer& out ) {
if (numSamples_)
out.setBufferData(numSamples_ * 4, &weights_[0], GL_R32F, GL_STATIC_DRAW);
}
#endif
//=============================================================================
#endif //MSFILTERWEIGHTS
......
......@@ -117,13 +117,11 @@ public:
virtual ~MSFilterWeights() { }
#if defined(GL_ARB_texture_buffer_object)
// Initializes a texture buffer with filter weights in format GL_R32F.
// This can be used for reading from multisampled textures in a shader.
void asTextureBuffer(TextureBuffer& out);
#endif
// get ptr to weights as array, can be used for setUniform() for example
const float* asDataPtr() const {return &weights_[0];}
......
......@@ -488,7 +488,6 @@ public:
*/
void updatePickingVertices_opt(ACG::GLState& _state);
#ifdef GL_ARB_texture_buffer_object
TextureBuffer* pickVertexMap_opt(){
if ( pickVertexMapTBO_.is_valid() )
......@@ -499,7 +498,6 @@ public:
}
}
#endif // GL_ARB_texture_buffer_object
private:
......@@ -509,10 +507,8 @@ private:
std::vector< ACG::Vec4uc > pickVertColBuf_;
#ifdef GL_ARB_texture_buffer_object
// map from vbo vertex id to openmesh vertex id
TextureBuffer pickVertexMapTBO_;
#endif // GL_ARB_texture_buffer_object
// vertex picking shader
GLSL::Program* pickVertexShader_;
......@@ -642,7 +638,6 @@ public:
*/
void updatePickingFaces_opt(ACG::GLState& _state );
#ifdef GL_ARB_texture_buffer_object
TextureBuffer* pickFaceTriangleMap_opt(){
if ( pickFaceTriToFaceMapTBO_.is_valid() )
......@@ -652,7 +647,6 @@ public:
return 0;
}
}
#endif
private:
......@@ -660,10 +654,8 @@ private:
std::vector< ACG::Vec3f > pickFaceVertexBuf_;
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
TextureBuffer pickFaceTriToFaceMapTBO_;
#endif // GL_ARB_texture_buffer_object
/// optimized face picking shader
GLSL::Program* pickFaceShader_;
......
......@@ -1621,9 +1621,8 @@ void DrawMeshT<Mesh>::updatePickingVertices_opt(ACG::GLState& _state)
rebuild();
}
#ifndef GL_ARB_texture_buffer_object
if(ACG::compatibilityProfile())
pickVertexMethod_ = 1; // no texture buffers supported during compilation
#endif
if (numVerts_)
{
......@@ -1631,7 +1630,8 @@ void DrawMeshT<Mesh>::updatePickingVertices_opt(ACG::GLState& _state)
if (pickVertexMethod_ == 0)
{
#ifdef GL_ARB_texture_buffer_object
if(!ACG::compatibilityProfile())
{
std::vector<int> forwardMap(numVerts_, 0);
......@@ -1642,8 +1642,7 @@ void DrawMeshT<Mesh>::updatePickingVertices_opt(ACG::GLState& _state)
forwardMap[vboIdx] = i;
}
pickVertexMapTBO_.setBufferData(sizeof(int) * numVerts_, &forwardMap[0], GL_R32I, GL_STATIC_DRAW);
#endif // GL_ARB_texture_buffer_object
}
}
else
......@@ -1729,9 +1728,8 @@ void ACG::DrawMeshT<Mesh>::drawPickingVertices_opt( const GLMatrixf& _mvp, size_
if (pickVertexMethod_ == 0)
{
pickVertexShader_->setUniform("vboToInputMap", 0);
#ifdef GL_ARB_texture_buffer_object
pickVertexMap_opt()->bind(GL_TEXTURE0);
#endif
if(!ACG::compatibilityProfile())
pickVertexMap_opt()->bind(GL_TEXTURE0);
}
pickVertexShader_->setUniform("mWVP", _mvp);
......@@ -2065,13 +2063,11 @@ void DrawMeshT<Mesh>::updatePickingFaces_opt(ACG::GLState& _state )
rebuild();
}
#ifdef GL_ARB_texture_buffer_object
if (meshComp_ && meshComp_->getNumTriangles())
if (!ACG::compatibilityProfile() && meshComp_ && meshComp_->getNumTriangles())
{
// upload tri->face lookup-table to texture buffer
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 _
pickFaceShader_->setUniform("pickFaceOffset", static_cast<GLint>(_pickOffset));
pickFaceShader_->setUniform("triToFaceMap", 0);
#ifdef GL_ARB_texture_buffer_object
pickFaceTriangleMap_opt()->bind(GL_TEXTURE0);
#endif
if(!ACG::compatibilityProfile())
pickFaceTriangleMap_opt()->bind(GL_TEXTURE0);
pickFaceShader_->setUniform("mWVP", _mvp);
......
......@@ -1802,9 +1802,7 @@ int GLState::getBufferTargetIndex(GLenum _target)
#ifdef GL_ARB_query_buffer_object
case GL_QUERY_BUFFER: return 11;
#endif
#ifdef GL_ARB_texture_buffer_object
case GL_TEXTURE_BUFFER: return 12;
#endif
#ifdef GL_VERSION_3_0
case GL_TRANSFORM_FEEDBACK_BUFFER: return 13;
#endif
......
......@@ -170,10 +170,8 @@ void IRenderer::addRenderObject(ACG::RenderObject* _renderObject)
for (std::map<size_t,RenderObject::Texture>::const_iterator it = _renderObject->textures().begin();
it != _renderObject->textures().end(); ++it)
{
#ifdef GL_ARB_texture_buffer_object
if (it->second.type == GL_TEXTURE_BUFFER)
continue; // skip texture buffers, for which testing for mipmaps would generate an error
#endif
glBindTexture(it->second.type, it->second.id);
......
......@@ -48,6 +48,7 @@
\*===========================================================================*/
#include "ShaderGenerator.hh"
#include <ACG/GL/acg_glew.hh>
#include <cstdio>
#include <iostream>
......@@ -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)
case GL_TEXTURE_RECTANGLE_ARB: type = "sampler2DRect"; break;
#endif
#ifdef GL_ARB_texture_buffer_object
case GL_TEXTURE_BUFFER_ARB: type = "samplerBuffer"; break;
#endif
case GL_TEXTURE_BUFFER: type = "samplerBuffer"; break;
#ifdef GL_EXT_texture_array
case GL_TEXTURE_1D_ARRAY_EXT: type = "sampler1DArray"; break;
case GL_TEXTURE_2D_ARRAY_EXT: type = "sampler2DArray"; break;
......@@ -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)
case GL_TEXTURE_RECTANGLE_ARB: resStrm << "GL_TEXTURE_RECTANGLE"; break;
#endif
#ifdef GL_ARB_texture_buffer_object
case GL_TEXTURE_BUFFER_ARB: resStrm << "GL_TEXTURE_BUFFER"; break;
#endif
case GL_TEXTURE_BUFFER: resStrm << "GL_TEXTURE_BUFFER"; break;
#ifdef GL_EXT_texture_array
case GL_TEXTURE_1D_ARRAY_EXT: resStrm << "GL_TEXTURE_1D_ARRAY"; break;
case GL_TEXTURE_2D_ARRAY_EXT: resStrm << "GL_TEXTURE_2D_ARRAY"; break;
......
......@@ -781,11 +781,7 @@ int VertexBufferObject::size() {
TextureBuffer::TextureBuffer(GLenum u)
:
#if defined(GL_ARB_texture_buffer_object)
Texture(GL_TEXTURE_BUFFER, u),
#else
Texture(0, u),
#endif
bufferSize_(0), buffer_(0), usage_(0), fmt_(0) {
}
......@@ -797,7 +793,8 @@ TextureBuffer::~TextureBuffer() {
void TextureBuffer::setBufferData(
size_t _size, const void* _data, GLenum _internalFormat, GLenum _usage) {
#if defined(GL_ARB_texture_buffer_object)
if(!ACG::compatibilityProfile())
{
if (supportsTextureBuffer()) {
// setup buffer object
if (!buffer_)
......@@ -821,13 +818,14 @@ void TextureBuffer::setBufferData(
}
else
std::cerr << "TextureBuffer::setData - gpu does not support buffer textures!" << std::endl;
#else
std::cerr << "TextureBuffer::setData - glew version too old, rebuild with latest glew!" << std::endl;
#endif
} else{
std::cerr << "TextureBuffer::setData - currently only in core profile available!" << std::endl;
}
}
bool TextureBuffer::getBufferData(void* _dst) {
#if defined(GL_ARB_texture_buffer_object)
if(!ACG::compatibilityProfile())
{
if (buffer_) {
glBindBuffer(GL_TEXTURE_BUFFER, buffer_);
glGetBufferSubData(GL_TEXTURE_BUFFER, 0, bufferSize_, _dst);
......@@ -835,9 +833,9 @@ bool TextureBuffer::getBufferData(void* _dst) {
}
else
std::cerr << "TextureBuffer::getBufferData - gpu does not support buffer textures!" << std::endl;
#else
std::cerr << "TextureBuffer::getBufferData - glew version too old, rebuild with latest glew!" << std::endl;
#endif
}else{
std::cerr << "TextureBuffer::getBufferData - currently only in core profile available!" << std::endl;
}
return false;
}
......
......@@ -78,8 +78,8 @@ void MeshNodeBase::supplyDrawMesh(DrawMeshBase *drawMeshBase) {
void MeshNodeBase::updatePolyEdgeBuf()
{
#ifdef GL_ARB_texture_buffer_object
if(!ACG::compatibilityProfile())
{
// drawMeshBase_ must have been supplied.
assert(drawMeshBase_);
......@@ -147,7 +147,7 @@ void MeshNodeBase::updatePolyEdgeBuf()
ACG::glCheckErrors();
}
}
#endif
}
}
......
Markdown is supported
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