Commit fb78c669 authored by Robert Menzel's avatar Robert Menzel

removed explicit error checks

parent ce2d6f47
......@@ -127,7 +127,6 @@ public:
} else if (mpFrameBufferObject) {
glm::uvec3 size = mpFrameBufferObject->getSize();
glViewport( 0, 0, size.x, size.y );
openGLRareError();
}
}
......
......@@ -54,7 +54,7 @@ public:
public:
inline void use (void) const
{
glViewport(mOffsetX, mOffsetY, mWidth, mHeight); openGLRareError();
glViewport(mOffsetX, mOffsetY, mWidth, mHeight);
}
inline void setOffset (GLint _offsetX, GLint _offsetY)
......
......@@ -44,12 +44,8 @@ class BufferObject {
public:
BufferObject()
{
glGenBuffers(1, &mObjectName);
if (openGLCriticalErrorOccured() ) {
ACGL::Utils::error() << "could not generate buffer!" << std::endl;
mObjectName = 0;
return;
}
glGenBuffers(1, &mObjectName);
}
~BufferObject(void)
......@@ -178,14 +174,12 @@ public:
inline void bind( GLenum _target ) const
{
glBindBuffer( _target, mBuffer->mObjectName );
openGLRareError();
}
//! Bind this buffer to its target
inline void bind() const
{
glBindBuffer( mTarget, mBuffer->mObjectName );
openGLRareError();
}
//! Set data for this buffer. Use only to init the buffer!
......@@ -194,7 +188,6 @@ public:
mSize = _sizeInBytes;
bind( _target );
glBufferData( _target, _sizeInBytes, _pData, _usage );
openGLRareError();
}
//! Set data for this buffer at the last used target. Use only to init the buffer!
......@@ -207,7 +200,6 @@ public:
GLsizeiptr _sizeInBytes, const GLvoid *_pData ) {
bind( _target );
glBufferSubData( _target, _offset, _sizeInBytes, _pData );
openGLRareError();
}
//! Use this to modify the buffer
......@@ -228,7 +220,6 @@ public:
GLvoid *mapRange( GLenum _target, GLintptr _offset, GLsizeiptr _length, GLbitfield _access ) {
bind( _target );
GLvoid *ret = glMapBufferRange( _target, _offset, _length, _access );
openGLRareError();
return ret;
}
......@@ -248,7 +239,6 @@ public:
void flushMappedRange( GLenum _target, GLsizeiptr _offset, GLsizeiptr _length ) {
bind( _target );
glFlushMappedBufferRange( _target, _offset, _length );
openGLRareError();
}
inline void flushMappedRange( GLintptr _offset, GLsizeiptr _length ) {
......@@ -286,7 +276,6 @@ public:
GLvoid *map( GLenum _target, GLenum _access ) {
bind( _target );
GLvoid *ret = glMapBuffer( _target, _access );
openGLRareError();
return ret;
}
inline GLvoid *map( GLenum _access ) {
......@@ -296,7 +285,6 @@ public:
GLboolean unmap( GLenum _target ) {
bind( _target );
GLboolean ret = glUnmapBuffer( _target );
openGLRareError();
return ret;
}
......
......@@ -89,12 +89,8 @@ public:
mColorAttachments(),
mDepthAttachment()
{
mObjectName = 0;
glGenFramebuffers(1, &mObjectName);
if (openGLCriticalErrorOccured() )
{
ACGL::Utils::error() << "could not generate FrameBufferObject!" << std::endl;
return;
}
mDepthAttachment.texture = ConstSharedTextureBase();
mDepthAttachment.renderBuffer = ConstSharedRenderBuffer();
mDepthAttachment.name = ""; // not useful here
......@@ -130,7 +126,6 @@ public:
inline void bind(GLenum _type = GL_FRAMEBUFFER) const
{
glBindFramebuffer(_type, mObjectName);
openGLRareError(); // glBindFramebuffer can only fail if the object name is no valid FBO which shouldn't happen using this framework
}
//! let OpenGL validate the completeness
......
......@@ -51,7 +51,6 @@ public:
inline void bind() const
{
glBindProgramPipeline( mObjectName );
openGLRareError();
}
//! unbinds the ProgramPipeline (if there is one bound), after that, ShaderPrograms can be used again directly
......
......@@ -40,11 +40,8 @@ public:
mWidth(0),
mHeight(0)
{
mObjectName = 0;
glGenRenderbuffers(1, &mObjectName);
if (openGLCriticalErrorOccured() ) {
ACGL::Utils::error() << "could not generate renderbuffer!" << std::endl;
return;
}
}
virtual ~RenderBuffer(void)
......
......@@ -56,7 +56,6 @@ public:
inline void bind(GLuint _textureUnit) const
{
glBindSampler( _textureUnit, mObjectName ); // yes, no adding of GL_TEXTURE0 !
openGLRareError();
}
//! unbinds the texture sampler (if there is one bound) from _textureUnit
......
......@@ -45,7 +45,6 @@ public:
{
mObjectName = glCreateShader(mType);
if (mObjectName == 0) {
openGLRareError();
ACGL::Utils::error() << "couldn't create Shader object! Requested type = " << (unsigned int) mType << std::endl;
}
}
......
......@@ -130,7 +130,6 @@ public:
inline void setUniformBlockBinding( const std::string& _blockName, GLuint _bindingPoint ) const {
GLuint blockIndex = getUniformBlockIndex(_blockName);
if (blockIndex != GL_INVALID_INDEX) glUniformBlockBinding( mObjectName, blockIndex, _bindingPoint );
openGLCommonError();
}
GLint getUniformBlockBinding( const std::string& _blockName ) const { return getUniformBlockBinding( getUniformBlockIndex(_blockName)); }
......
......@@ -73,9 +73,6 @@ public:
mInternalFormat(GL_RGBA)
{
glGenTextures(1, &mObjectName);
if (openGLCriticalErrorOccured() ) {
ACGL::Utils::error() << "could not generate texture!" << std::endl;
}
}
TextureBase(GLenum _target, GLenum _internalFormat)
......@@ -87,9 +84,6 @@ public:
mInternalFormat(_internalFormat)
{
glGenTextures(1, &mObjectName);
if (openGLCriticalErrorOccured() ) {
ACGL::Utils::error() << "could not generate texture!" << std::endl;
}
}
virtual ~TextureBase(void)
......@@ -134,14 +128,12 @@ public:
{
glActiveTexture(GL_TEXTURE0 + _textureUnit);
glBindTexture(mTarget, mObjectName);
openGLRareError();
}
//! Bind this texture to the currently active texture unit.
inline void bind(void) const
{
glBindTexture(mTarget, mObjectName);
openGLRareError();
}
//! sets the minification filter
......
......@@ -36,10 +36,8 @@ class TextureBuffer : public Buffer
public:
// create a new BufferObject with _reservedMemory space (in bytes!)
TextureBuffer( GLenum _dataType, size_t _reservedMemory = 1 ) : Buffer(GL_TEXTURE_BUFFER) {
mTextureObjectName = 0;
glGenTextures(1, &mTextureObjectName);
if (openGLCriticalErrorOccured() ) {
ACGL::Utils::error() << "could not generate texture object for texture buffer!" << std::endl;
}
mDataType = _dataType;
Buffer::setData( _reservedMemory );
attachBufferToTexture();
......@@ -47,10 +45,8 @@ public:
// use an existing BufferObject
TextureBuffer( GLenum _dataType, SharedBufferObject _pBuffer ) : Buffer(_pBuffer, GL_TEXTURE_BUFFER) {
mTextureObjectName = 0;
glGenTextures(1, &mTextureObjectName);
if (openGLCriticalErrorOccured() ) {
ACGL::Utils::error() << "could not generate texture object for texture buffer!" << std::endl;
}
mDataType = _dataType;
attachBufferToTexture();
}
......@@ -75,7 +71,6 @@ public:
void bindTexture(GLuint _textureUnit = 0) const {
glActiveTexture(GL_TEXTURE0 + _textureUnit);
glBindTexture(GL_TEXTURE_BUFFER, mTextureObjectName);
openGLRareError();
}
//! Bind the buffer part to change the data
......@@ -101,7 +96,6 @@ private:
bindTexture();
glTexBuffer( GL_TEXTURE_BUFFER, mDataType, Buffer::getObjectName() );
}
openGLCriticalErrorOccured();
}
GLenum mDataType;
......
......@@ -219,12 +219,11 @@ public:
//! Will select the matching draw call. Remember to bind() first!
void draw( GLsizei _primcount = 1 ) const
{
if(mpElementArrayBuffer)
if (mpElementArrayBuffer) {
drawElements( _primcount );
else
} else {
drawArrays( _primcount );
openGLRareError();
}
}
// ===================================================================================================== \/
......
......@@ -97,7 +97,7 @@ SharedShaderProgram ShaderProgramCreator::create()
if (!setBindings( shaderProgram )) {
return SharedShaderProgram(); // e.g. linking failed
}
openGLCommonError();
updateFileModificationTimes();
return shaderProgram;
}
......@@ -105,18 +105,14 @@ SharedShaderProgram ShaderProgramCreator::create()
// will get called from the create and update functions:
bool ShaderProgramCreator::setBindings(SharedShaderProgram &_shaderProgram)
{
openGLRareError();
_shaderProgram->link();
# if (ACGL_OPENGL_VERSION >= 30)
_shaderProgram->setFragmentDataLocations( mFragmentDataLocations ); // might relink on it's own
openGLRareError();
SharedLocationMappings oldAttributeMap = _shaderProgram->getAttributeLocations();
mAttributeLocations->addLocations( oldAttributeMap ); // add as many old locations as possible without destoying the location map
_shaderProgram->setAttributeLocations( mAttributeLocations ); // might relink on it's own
openGLRareError();
# else
if ( (mAttributeLocations->getSize() > 0) && (mFragmentDataLocations->getSize() > 0) ) {
Utils::error() << "can't set explicit attribute/fragdata locations on OpenGL < 3.0" << std::endl;
......
......@@ -27,7 +27,6 @@ void RenderObject::updateMappings()
}
mpVertexArrayObject->setAttributeLocations( mpShaderProgramObject->getShaderProgram()->getAttributeLocations() );
openGLRareError();
*/
}
......@@ -43,13 +42,11 @@ void RenderObject::enableFrameBufferObject() const
{
glBindFramebuffer( GL_FRAMEBUFFER, 0 );
}
openGLRareError();
}
void RenderObject::disableFrameBufferObject() const
{
glBindFramebuffer( GL_FRAMEBUFFER, mLastFBO );
openGLRareError();
}
......@@ -57,13 +54,11 @@ void RenderObject::enableShaderProgramObject() const
{
glGetIntegerv( GL_CURRENT_PROGRAM, &mLastShaderProgram );
mpShaderProgramObject->use();
openGLRareError();
}
void RenderObject::disableShaderProgramObject() const
{
glUseProgram( mLastShaderProgram );
openGLRareError();
}
void RenderObject::enableVertexArrayObject() const
......@@ -72,13 +67,11 @@ void RenderObject::enableVertexArrayObject() const
glGetIntegerv( GL_VERTEX_ARRAY_BINDING, &mLastVAO );
mpVertexArrayObject->bind();
openGLRareError();
}
void RenderObject::disableVertexArrayObject() const
{
glBindVertexArray( mLastVAO );
openGLRareError();
}
void RenderObject::enableViewport() const
......@@ -91,7 +84,6 @@ void RenderObject::enableViewport() const
} else if (mpFrameBufferObject) {
glm::uvec3 size = mpFrameBufferObject->getSize();
glViewport( 0, 0, size.x, size.y );
openGLRareError();
}
}
......
......@@ -124,7 +124,6 @@ bool FrameBufferObject::attachColorAttachment( const Attachment &_attachment )
// attach it to the OpenGL object:
bind();
openGLCriticalError();
if (_attachment.renderBuffer) {
// it's a renderBuffer
glFramebufferRenderbuffer( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + realLocation, GL_RENDERBUFFER, _attachment.renderBuffer->getObjectName() );
......@@ -182,11 +181,6 @@ bool FrameBufferObject::attachColorAttachment( const Attachment &_attachment )
//Utils::debug() << "glFramebufferTexture2D( " << _attachment.name << " to " << realLocation <<" )" << std::endl;
}
if (openGLCommonErrorOccured())
{
Utils::error() << "Attaching of render target to the FBO failed" << std::endl;
return false;
}
remapAttachments();
return true;
......@@ -317,8 +311,6 @@ SharedTextureData FrameBufferObject::getImageData(GLsizei _width, GLsizei _heigh
texData->setData(frameBufferData); // frameBufferData memory will be managed by texData
texData->setPadding(paddingPerRow);
openGLRareError();
return texData;
}
......
......@@ -12,12 +12,8 @@ using namespace ACGL::OpenGL;
ProgramPipeline::ProgramPipeline()
{
glGenProgramPipelines(1, &mObjectName);
if (openGLCriticalErrorOccured() ) {
ACGL::Utils::error() << "could not generate ProgramPipeline!" << std::endl;
mObjectName = 0;
return;
}
glGenProgramPipelines(1, &mObjectName);
}
ProgramPipeline::~ProgramPipeline(void)
......
......@@ -13,12 +13,8 @@ using namespace ACGL::OpenGL;
Sampler::Sampler()
{
glGenSamplers(1, &mObjectName);
if (openGLCriticalErrorOccured() ) {
ACGL::Utils::error() << "could not generate sampler!" << std::endl;
mObjectName = 0;
return;
}
glGenSamplers(1, &mObjectName);
}
Sampler::~Sampler(void)
......@@ -34,7 +30,6 @@ void Sampler::setMaxAnisotropy( GLfloat _sampleCount )
_sampleCount = std::max( _sampleCount, 1.0f );
_sampleCount = std::min( _sampleCount, ACGL_MAX_TEXTURE_MAX_ANISOTROPY );
glSamplerParameterf( mObjectName, GL_TEXTURE_MAX_ANISOTROPY_EXT, _sampleCount );
openGLRareError();
} else
{
if (_sampleCount != 1.0f ) {
......
......@@ -129,17 +129,6 @@ bool Shader::setSources(const std::vector<std::string> &_sources, bool _checkFor
bool Shader::compile() const
{
glCompileShader(mObjectName);
#ifdef ACGL_CHECK_CRITICAL_GL_ERRORS
// problems with the shader creation are always a bad thing...
// from here on only error checks are performed:
//
if ( openGLRareErrorOccured() )
{
error() << "glCompileShader failed, that can only mean, that the object name used is not a valid shader object!" << std::endl;
return false;
}
#endif
return true;
}
......
......@@ -18,13 +18,6 @@ bool ShaderProgram::link() const
glLinkProgram(mObjectName);
#ifdef ACGL_CHECK_CRITICAL_GL_ERRORS
if ( openGLRareErrorOccured() )
{
// it's uncommon that glLinkProgram creates errors,
// linking errors create no gl errors but a GL_LINK_STATUS of GL_FALSE
return false;
}
// check for program link errors:
GLint programError;
glGetProgramiv(mObjectName, GL_LINK_STATUS, &programError);
......@@ -42,7 +35,6 @@ bool ShaderProgram::link() const
// error log or warnings:
GLchar* pInfo = new char[length + 1];
glGetProgramInfoLog(mObjectName, length, &length, pInfo);
openGLRareError();
warning() << "Linker log: " << std::string(pInfo) << std::endl;
delete[] pInfo;
return (programError == GL_TRUE); // if the log contains only warnings we return true
......@@ -81,7 +73,6 @@ void ShaderProgram::setAttributeLocations(ConstSharedLocationMappings _locationM
if(needsRelink)
{
link();
openGLRareError();
}
}
......@@ -113,7 +104,6 @@ void ShaderProgram::setFragmentDataLocations(ConstSharedLocationMappings _locati
if(needsRelink)
{
link();
openGLRareError();
}
}
#endif // (ACGL_OPENGL_VERSION >= 30)
......
......@@ -130,7 +130,6 @@ void TextureBase::setAnisotropicFilter( GLfloat _sampleCount )
glTexParameterf( mTarget, GL_TEXTURE_MAX_ANISOTROPY_EXT, _sampleCount );
glBindTexture(mTarget, prevTexture);
openGLRareError();
} else
{
if (_sampleCount != 1.0f ) {
......@@ -151,7 +150,6 @@ void TextureBase::generateMipmaps(void)
// this is not needed by the spec and deprecated on core profiles (generates
// an error on MacOS X Lion)
glEnable(mTarget);
openGLRareError();
#endif
#ifdef ACGL_OPENGL_VERSION_21
// OpenGL 2 way to generate MipMaps
......@@ -161,7 +159,6 @@ void TextureBase::generateMipmaps(void)
#endif
glBindTexture(mTarget, prevTexture);
openGLRareError();
}
GLint TextureBase::getParameterI( GLenum _name ) const
......@@ -170,7 +167,6 @@ GLint TextureBase::getParameterI( GLenum _name ) const
GLint param;
glGetTexParameteriv( mTarget, _name, &param );
glBindTexture(mTarget, prevTexture);
openGLRareError();
return param;
}
......@@ -180,7 +176,6 @@ GLfloat TextureBase::getParameterF( GLenum _name ) const
GLfloat param;
glGetTexParameterfv( mTarget, _name, &param );
glBindTexture(mTarget, prevTexture);
openGLRareError();
return param;
}
......@@ -190,7 +185,6 @@ glm::vec4 TextureBase::getParameter4F( GLenum _name ) const
glm::vec4 param;
glGetTexParameterfv( mTarget, _name, (GLfloat*)&param );
glBindTexture(mTarget, prevTexture);
openGLRareError();
return param;
}
......@@ -383,7 +377,6 @@ void TextureRectangle::setImageData( const SharedTextureData &_data )
mWidth = _data->getWidth();
mHeight = _data->getHeight();
openGLCriticalError();
bind();
glTexImage2D(
mTarget,
......@@ -394,7 +387,6 @@ void TextureRectangle::setImageData( const SharedTextureData &_data )
_data->getFormat(),
_data->getType(),
_data->getData() );
openGLCriticalError();
}
......@@ -617,7 +609,6 @@ void TextureCubeMap::texImage2DCube( const SharedTextureData &_data, GLenum _cub
_data->getFormat(),
_data->getType(),
_data->getData() );
openGLRareError();
}
void TextureCubeMap::texSubImage2DCube( const SharedTextureData &_data, GLenum _cubeSide, GLint _mipmapLevel, glm::ivec2 _offset )
......@@ -631,7 +622,6 @@ void TextureCubeMap::texSubImage2DCube( const SharedTextureData &_data, GLenum _
_data->getFormat(),
_data->getType(),
_data->getData() );
openGLRareError();
}
......@@ -650,7 +640,6 @@ void TextureBase::texImage1D( const SharedTextureData &_data, GLint _mipmapLevel
_data->getFormat(),
_data->getType(),
_data->getData() );
openGLRareError();
}
void TextureBase::texSubImage1D( const SharedTextureData &_data, GLint _mipmapLevel, uint32_t _offset )
......@@ -666,7 +655,6 @@ void TextureBase::texSubImage1D( const SharedTextureData &_data, GLint _mipmapLe
_data->getFormat(),
_data->getType(),
_data->getData() );
openGLRareError();
}
void TextureBase::texImage2D( const SharedTextureData &_data, GLint _mipmapLevel )
......@@ -684,7 +672,6 @@ void TextureBase::texImage2D( const SharedTextureData &_data, GLint _mipmapLevel
_data->getFormat(),
_data->getType(),
_data->getData() );
openGLRareError();
}
void TextureBase::texSubImage2D( const SharedTextureData &_data, GLint _mipmapLevel, glm::uvec2 _offset )
......@@ -701,7 +688,6 @@ void TextureBase::texSubImage2D( const SharedTextureData &_data, GLint _mipmapLe
_data->getFormat(),
_data->getType(),
_data->getData() );
openGLRareError();
}
......@@ -721,7 +707,6 @@ void TextureBase::texImage3D( const SharedTextureData &_data, GLint _mipmapLevel
_data->getFormat(),
_data->getType(),
_data->getData() );
openGLRareError();
}
void TextureBase::texSubImage3D( const SharedTextureData &_data, GLint _mipmapLevel, glm::uvec3 _offset )
......@@ -739,6 +724,5 @@ void TextureBase::texSubImage3D( const SharedTextureData &_data, GLint _mipmapLe
_data->getFormat(),
_data->getType(),
_data->getData() );
openGLRareError();
}
......@@ -21,10 +21,6 @@ VertexArrayObject::VertexArrayObject( GLenum _mode ) :
GLint maxAttributes;
glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &maxAttributes);
if (openGLCriticalErrorOccured() ) {
ACGL::Utils::error() << "could not generate vertex array object!" << std::endl;
}
mAttributes.resize( maxAttributes ); // reserve probably 16 slots, the size() can now be used to query the MAX_VERTEX_ATTRIBS
}
......
......@@ -54,12 +54,7 @@ uint32_t privateGetOpenGLVersion( int _type )
// NOTE: similar to GLEW we assume here, that the minor and major numbers
// only have one digit. We also ignore release numbers. This will fail e.g. for OpenGL 10.0
const GLubyte* versionString;
openGLRareError(); // clear errors
versionString = glGetString(GL_VERSION);
if (openGLRareErrorOccured()) {
ACGL::Utils::error() << "could not query OpenGL version!" << std::endl;
return false;
}
int positionOfFirstDot = 0;
while ((versionString[positionOfFirstDot] != '\0') && (versionString[positionOfFirstDot] != '.')) ++positionOfFirstDot;
......
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