Commit 0e984a53 authored by Robert Menzel's avatar Robert Menzel

Changed naming of the OpenGL object names

OpenGL object names were misleadingly named context which can be mixed up with
the OpenGL context. Object name is the correct term used in the specs.
parent 2bed8313
......@@ -68,14 +68,14 @@ public:
ArrayBuffer(
GLenum _usage = GL_STATIC_DRAW,
GLenum _mode = GL_TRIANGLES)
: mContext(0),
: mObjectName(0),
mUsage(_usage),
mMode(_mode),
mElements(0),
mStride(0),
mAttributes()
{
glGenBuffers(1, &mContext);
glGenBuffers(1, &mObjectName);
if (openGLCriticalErrorOccured() ) {
ACGL::Utils::error() << "could not generate array buffer!" << std::endl;
}
......@@ -84,14 +84,15 @@ public:
virtual ~ArrayBuffer(void)
{
// buffer 0 will get ignored by OpenGL
glDeleteBuffers(1, &mContext);
glDeleteBuffers(1, &mObjectName);
}
// ==================================================================================================== \/
// ============================================================================================ GETTERS \/
// ==================================================================================================== \/
public:
inline GLuint getContext (void) const { return mContext; }
inline GLuint operator() (void) const { return mObjectName; }
inline GLuint getObjectName (void) const { return mObjectName; }
inline GLenum getUsage (void) const { return mUsage; }
inline GLenum getMode (void) const { return mMode; }
inline GLsizei getElements (void) const { return mElements; }
......@@ -147,7 +148,7 @@ public:
//! Bind this buffer
inline void bind(void) const
{
glBindBuffer(GL_ARRAY_BUFFER, mContext);
glBindBuffer(GL_ARRAY_BUFFER, mObjectName);
openGLRareError();
}
......@@ -198,7 +199,7 @@ public:
//! Note: The function is not const, because it changes the corresponding GPU data
inline void setData(const GLvoid* _pData)
{
glBindBuffer(GL_ARRAY_BUFFER, mContext);
glBindBuffer(GL_ARRAY_BUFFER, mObjectName);
glBufferData(
GL_ARRAY_BUFFER,
mStride * mElements,
......@@ -210,7 +211,7 @@ public:
// ============================================================================================ FIELDS \/
// =================================================================================================== \/
protected:
GLuint mContext;
GLuint mObjectName;
GLenum mUsage;
GLenum mMode;
GLsizei mElements;
......
......@@ -43,14 +43,14 @@ public:
GLenum _usage = GL_STATIC_DRAW,
GLenum _mode = GL_TRIANGLES,
GLenum _type = GL_UNSIGNED_INT)
: mContext(0),
: mObjectName(0),
mUsage(_usage),
mMode(_mode),
mElements(0),
mType(_type),
mSizeOfType(getGLTypeSize(_type))
{
glGenBuffers(1, &mContext);
glGenBuffers(1, &mObjectName);
if (openGLCriticalErrorOccured() ) {
ACGL::Utils::error() << "could not generate element array buffer!" << std::endl;
}
......@@ -60,14 +60,15 @@ public:
virtual ~ElementArrayBuffer(void)
{
// buffer 0 will get ignored by OpenGL
glDeleteBuffers(1, &mContext);
glDeleteBuffers(1, &mObjectName);
}
// ==================================================================================================== \/
// ============================================================================================ GETTERS \/
// ==================================================================================================== \/
public:
inline GLuint getContext (void) const { return mContext; }
inline GLuint operator() (void) const { return mObjectName; }
inline GLuint getObjectName (void) const { return mObjectName; }
inline GLenum getUsage (void) const { return mUsage; }
inline GLenum getMode (void) const { return mMode; }
inline GLsizei getElements (void) const { return mElements; }
......@@ -94,7 +95,7 @@ public:
//! Bind this buffer
inline void bind(void) const
{
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mContext);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mObjectName);
}
void draw(GLint _first, GLsizei _count) const
......@@ -123,7 +124,7 @@ public:
inline void setData(
const GLvoid* _pData)
{
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mContext);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mObjectName);
glBufferData(
GL_ELEMENT_ARRAY_BUFFER,
mElements * mSizeOfType,
......@@ -136,7 +137,7 @@ public:
// ============================================================================================ FIELDS \/
// =================================================================================================== \/
protected:
GLuint mContext;
GLuint mObjectName;
GLenum mUsage;
GLenum mMode;
GLsizei mElements;
......
......@@ -70,12 +70,12 @@ public:
// ========================================================================================================= \/
public:
FrameBufferObject(void)
: mContext(0),
: mObjectName(0),
mDrawBuffers(0),
mColorAttachments(),
mDepthAttachment()
{
glGenFramebuffers(1, &mContext);
glGenFramebuffers(1, &mObjectName);
if (openGLCriticalErrorOccured() ) {
ACGL::Utils::error() << "could not generate FrameBufferObject!" << std::endl;
return;
......@@ -88,14 +88,15 @@ public:
virtual ~FrameBufferObject(void)
{
// buffer 0 will get ignored by OpenGL
glDeleteFramebuffers(1, &mContext);
glDeleteFramebuffers(1, &mObjectName);
}
// ==================================================================================================== \/
// ============================================================================================ GETTERS \/
// ==================================================================================================== \/
public:
inline GLuint getContext (void) const { return mContext; }
inline GLuint operator() (void) const { return mObjectName; }
inline GLuint getObjectName (void) const { return mObjectName; }
inline const AttachmentVec& getColorAttachments (void) const { return mColorAttachments; }
inline const Attachment& getDepthAttachment (void) const { return mDepthAttachment; }
......@@ -113,13 +114,13 @@ public:
*/
inline void bind(GLenum _type = GL_FRAMEBUFFER) const
{
glBindFramebuffer(_type, mContext);
openGLRareError(); // glBindFramebuffer can only fail if the context is no valid FBO which shouldn't happen using this framework
glBindFramebuffer(_type, mObjectName);
openGLRareError(); // glBindFramebuffer can only fail if the object name is no valid FBO which shouldn't happen using this framework
}
inline void bindAsRenderTarget(GLenum _type = GL_FRAMEBUFFER) const
{
glBindFramebuffer(_type, mContext);
glBindFramebuffer(_type, mObjectName);
glDrawBuffers(mDrawBuffers, msBuffers);
openGLRareError();
}
......@@ -127,7 +128,7 @@ public:
/*
inline void bindAsRenderTarget(GLint _x, GLint _y, GLsizei _w, GLsizei _h, GLenum _type = GL_FRAMEBUFFER) const
{
glBindFramebuffer(_type, mContext);
glBindFramebuffer(_type, mObjectName);
glDrawBuffers(mDrawBuffers, msBuffers);
openGLRareError();
}*/
......@@ -144,7 +145,7 @@ public:
inline bool attachColorRenderBuffer(const std::string _name, const ConstSharedRenderBuffer& _renderBuffer)
{
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + mDrawBuffers, GL_RENDERBUFFER, _renderBuffer->getContext());
glFramebufferRenderbuffer( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + mDrawBuffers, GL_RENDERBUFFER, _renderBuffer->getObjectName() );
if (openGLCommonErrorOccured()) {
Utils::error() << "Attaching of texture to the FBO failed" << std::endl;
return false;
......@@ -157,7 +158,7 @@ public:
inline bool attachColorTexture(const std::string _name, const ConstSharedTexture& _texture)
{
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + mDrawBuffers, _texture->getTarget(), _texture->getContext(), 0);
glFramebufferTexture2D( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + mDrawBuffers, _texture->getTarget(), _texture->getObjectName(), 0 );
if (openGLCommonErrorOccured()) {
Utils::error() << "Attaching of texture to the FBO failed" << std::endl;
return false;
......@@ -170,15 +171,15 @@ public:
inline bool setDepthRenderBuffer(const ConstSharedRenderBuffer& _renderBuffer)
{
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, _renderBuffer->getContext());
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, _renderBuffer->getObjectName() );
#ifdef ACGL_OPENGL_ES
if( _renderBuffer->getInternalFormat() == GL_DEPTH24_STENCIL8_OES ||
_renderBuffer->getInternalFormat() == GL_DEPTH_STENCIL_OES)
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, _renderBuffer->getContext());
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, _renderBuffer->getObjectName() );
#else
if( _renderBuffer->getInternalFormat() == GL_DEPTH24_STENCIL8 ||
_renderBuffer->getInternalFormat() == GL_DEPTH_STENCIL)
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, _renderBuffer->getContext());
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, _renderBuffer->getObjectName() );
#endif
mDepthAttachment.renderBuffer = _renderBuffer;
return true;
......@@ -186,15 +187,15 @@ public:
inline bool setDepthTexture(const ConstSharedTexture& _texture)
{
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, _texture->getTarget(), _texture->getContext(), 0);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, _texture->getTarget(), _texture->getObjectName(), 0);
#ifdef ACGL_OPENGL_ES
if( _texture->getInternalFormat() == GL_DEPTH24_STENCIL8_OES ||
_texture->getInternalFormat() == GL_DEPTH_STENCIL_OES)
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, _texture->getTarget(), _texture->getContext(), 0);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, _texture->getTarget(), _texture->getObjectName(), 0);
#else
if( _texture->getInternalFormat() == GL_DEPTH24_STENCIL8 ||
_texture->getInternalFormat() == GL_DEPTH_STENCIL)
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, _texture->getTarget(), _texture->getContext(), 0);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, _texture->getTarget(), _texture->getObjectName(), 0);
#endif
mDepthAttachment.texture = _texture;
return true;
......@@ -204,7 +205,7 @@ public:
// ============================================================================================ FIELDS \/
// =================================================================================================== \/
protected:
GLuint mContext;
GLuint mObjectName;
GLsizei mDrawBuffers;
AttachmentVec mColorAttachments;
Attachment mDepthAttachment; // depth and stencil are combined
......
......@@ -27,12 +27,12 @@ class RenderBuffer
public:
RenderBuffer(
GLenum _internalFormat)
: mContext(0),
: mObjectName(0),
mInternalFormat(_internalFormat),
mWidth(0),
mHeight(0)
{
glGenRenderbuffers(1, &mContext);
glGenRenderbuffers(1, &mObjectName);
if (openGLCriticalErrorOccured() ) {
ACGL::Utils::error() << "could not generate renderbuffer!" << std::endl;
return;
......@@ -42,14 +42,15 @@ public:
virtual ~RenderBuffer(void)
{
// buffer 0 will get ignored by OpenGL
glDeleteRenderbuffers(1, &mContext);
glDeleteRenderbuffers(1, &mObjectName);
}
// ==================================================================================================== \/
// ============================================================================================ GETTERS \/
// ==================================================================================================== \/
public:
inline GLuint getContext (void) const { return mContext; }
inline GLuint operator() (void) const { return mObjectName; }
inline GLuint getObjectName (void) const { return mObjectName; }
inline GLenum getInternalFormat (void) const { return mInternalFormat; }
inline GLsizei getWidth (void) const { return mWidth; }
inline GLsizei getHeight (void) const { return mHeight; }
......@@ -61,7 +62,7 @@ public:
//! Bind the renderbuffer
inline void bind(void) const
{
glBindRenderbuffer(GL_RENDERBUFFER, mContext);
glBindRenderbuffer(GL_RENDERBUFFER, mObjectName);
}
//! Set texture size and NULL data
......@@ -71,7 +72,7 @@ public:
{
mWidth = _width;
mHeight = _height;
glBindRenderbuffer(GL_RENDERBUFFER, mContext);
glBindRenderbuffer(GL_RENDERBUFFER, mObjectName);
glRenderbufferStorage(GL_RENDERBUFFER, mInternalFormat, mWidth, mHeight);
}
......@@ -79,7 +80,7 @@ public:
// ============================================================================================ FIELDS \/
// =================================================================================================== \/
protected:
GLuint mContext;
GLuint mObjectName;
GLenum mInternalFormat;
GLsizei mWidth;
GLsizei mHeight;
......
......@@ -36,24 +36,25 @@ class Shader
// ========================================================================================================= \/
public:
Shader(GLenum _type)
: mContext(0),
: mObjectName(0),
mType(_type)
{
mContext = glCreateShader(mType);
mObjectName = glCreateShader(mType);
}
virtual ~Shader(void)
{
// "DeleteShader will silently ignore the value zero." - GL Spec
glDeleteShader(mContext);
glDeleteShader(mObjectName);
}
// ==================================================================================================== \/
// ============================================================================================ GETTERS \/
// ==================================================================================================== \/
public:
inline GLuint getContext (void) const { return mContext; }
inline GLenum getType (void) const { return mType; }
inline GLuint operator() (void) const { return mObjectName; }
inline GLuint getObjectName(void) const { return mObjectName; }
inline GLenum getType (void) const { return mType; }
// ==================================================================================================== \/
// ============================================================================================ METHODS \/
......@@ -69,7 +70,7 @@ protected:
// ============================================================================================ FIELDS \/
// =================================================================================================== \/
protected:
GLuint mContext;
GLuint mObjectName;
GLenum mType;
};
......
......@@ -69,42 +69,43 @@ public:
// ========================================================================================================= \/
public:
ShaderProgram(void)
: mContext(0),
: mObjectName(0),
mShaders()
{
mContext = glCreateProgram();
mObjectName = glCreateProgram();
}
virtual ~ShaderProgram(void)
{
// "DeleteProgram will silently ignore the value zero." - GL Spec
glDeleteProgram(mContext);
glDeleteProgram(mObjectName);
}
// ==================================================================================================== \/
// ============================================================================================ GETTERS \/
// ==================================================================================================== \/
public:
inline GLuint getContext (void) const { return mContext; }
inline const ConstSharedShaderVec& getShaders (void) const { return mShaders; }
inline GLuint operator() (void) const { return mObjectName; }
inline GLuint getObjectName(void) const { return mObjectName; }
inline const ConstSharedShaderVec& getShaders (void) const { return mShaders; }
// ===================================================================================================== \/
// ============================================================================================ WRAPPERS \/
// ===================================================================================================== \/
public:
inline GLint getUniformLocation (const std::string& _nameInShader) const { return glGetUniformLocation (mContext, _nameInShader.c_str()); }
inline GLint getUniformLocation (const std::string& _nameInShader) const { return glGetUniformLocation (mObjectName, _nameInShader.c_str()); }
#if (ACGL_OPENGL_VERSION >= 30)
inline GLint getAttributeLocation (const std::string& _nameInShader) const { return glGetAttribLocation (mContext, _nameInShader.c_str()); }
inline GLint getFragmentDataLocation (const std::string& _nameInShader) const { return glGetFragDataLocation(mContext, _nameInShader.c_str()); }
inline void bindAttributeLocation (const std::string& _nameInShader, GLuint _location) const { glBindAttribLocation (mContext, _location, _nameInShader.c_str()); }
inline void bindFragmentDataLocation (const std::string& _nameInShader, GLuint _location) const { glBindFragDataLocation (mContext, _location, _nameInShader.c_str()); }
inline GLint getAttributeLocation (const std::string& _nameInShader) const { return glGetAttribLocation (mObjectName, _nameInShader.c_str()); }
inline GLint getFragmentDataLocation (const std::string& _nameInShader) const { return glGetFragDataLocation(mObjectName, _nameInShader.c_str()); }
inline void bindAttributeLocation (const std::string& _nameInShader, GLuint _location) const { glBindAttribLocation (mObjectName, _location, _nameInShader.c_str()); }
inline void bindFragmentDataLocation (const std::string& _nameInShader, GLuint _location) const { glBindFragDataLocation (mObjectName, _location, _nameInShader.c_str()); }
#endif
inline void use(void) const { glUseProgram(mContext); }
inline void use(void) const { glUseProgram(mObjectName); }
inline void attachShader(const ConstSharedShader& _shader)
{
mShaders.push_back(_shader);
glAttachShader(mContext, _shader->getContext());
glAttachShader( mObjectName, _shader->getObjectName() );
}
bool link (void) const;
......@@ -125,18 +126,18 @@ public:
//DSA versions:
inline void setProgramUniform (GLint _location, GLint _v) const { glProgramUniform1i (mContext, _location, _v); }
inline void setProgramUniform (GLint _location, GLfloat _v) const { glProgramUniform1f (mContext, _location, _v); }
inline void setProgramUniform (GLint _location, GLint _v) const { glProgramUniform1i (mObjectName, _location, _v); }
inline void setProgramUniform (GLint _location, GLfloat _v) const { glProgramUniform1f (mObjectName, _location, _v); }
inline void setProgramUniform (GLint _location, const glm::vec2& _v) const { glProgramUniform2fv(mContext, _location, 1, glm::value_ptr(_v)); }
inline void setProgramUniform (GLint _location, const glm::vec3& _v) const { glProgramUniform3fv(mContext, _location, 1, glm::value_ptr(_v)); }
inline void setProgramUniform (GLint _location, const glm::vec4& _v) const { glProgramUniform4fv(mContext, _location, 1, glm::value_ptr(_v)); }
inline void setProgramUniform (GLint _location, const glm::vec2& _v) const { glProgramUniform2fv(mObjectName, _location, 1, glm::value_ptr(_v)); }
inline void setProgramUniform (GLint _location, const glm::vec3& _v) const { glProgramUniform3fv(mObjectName, _location, 1, glm::value_ptr(_v)); }
inline void setProgramUniform (GLint _location, const glm::vec4& _v) const { glProgramUniform4fv(mObjectName, _location, 1, glm::value_ptr(_v)); }
inline void setProgramUniform (GLint _location, const glm::mat2& _v, GLboolean _transpose = GL_FALSE) const { glProgramUniformMatrix2fv(mContext, _location, 1, _transpose, glm::value_ptr(_v)); }
inline void setProgramUniform (GLint _location, const glm::mat3& _v, GLboolean _transpose = GL_FALSE) const { glProgramUniformMatrix3fv(mContext, _location, 1, _transpose, glm::value_ptr(_v)); }
inline void setProgramUniform (GLint _location, const glm::mat4& _v, GLboolean _transpose = GL_FALSE) const { glProgramUniformMatrix4fv(mContext, _location, 1, _transpose, glm::value_ptr(_v)); }
inline void setProgramUniform (GLint _location, const glm::mat2& _v, GLboolean _transpose = GL_FALSE) const { glProgramUniformMatrix2fv(mObjectName, _location, 1, _transpose, glm::value_ptr(_v)); }
inline void setProgramUniform (GLint _location, const glm::mat3& _v, GLboolean _transpose = GL_FALSE) const { glProgramUniformMatrix3fv(mObjectName, _location, 1, _transpose, glm::value_ptr(_v)); }
inline void setProgramUniform (GLint _location, const glm::mat4& _v, GLboolean _transpose = GL_FALSE) const { glProgramUniformMatrix4fv(mObjectName, _location, 1, _transpose, glm::value_ptr(_v)); }
inline void setProgramTexture (GLint _location, const ConstSharedTexture& _texture, GLenum _unit = 0) const { glProgramUniform1i(mContext, _location, _unit); _texture->bind(_unit); }
inline void setProgramTexture (GLint _location, const ConstSharedTexture& _texture, GLenum _unit = 0) const { glProgramUniform1i(mObjectName, _location, _unit); _texture->bind(_unit); }
// =================================================================================================== \/
// ============================================================================== HIGH LEVEL FUNCTIONS \/
......@@ -175,7 +176,7 @@ public:
// ============================================================================================ FIELDS \/
// =================================================================================================== \/
protected:
GLuint mContext;
GLuint mObjectName;
ConstSharedShaderVec mShaders;
};
......
......@@ -37,7 +37,7 @@ public:
Default texture parameters taken from: http://www.opengl.org/sdk/docs/man/xhtml/glTexParameter.xml
*/
Texture(GLenum _target)
: mContext(0),
: mObjectName(0),
mTarget(_target),
mWidth(0),
mHeight(0),
......@@ -48,7 +48,7 @@ public:
mMinFilter(GL_NEAREST_MIPMAP_LINEAR),
mMagFilter(GL_LINEAR)
{
glGenTextures(1, &mContext);
glGenTextures(1, &mObjectName);
if (openGLCriticalErrorOccured() ) {
ACGL::Utils::error() << "could not generate texture!" << std::endl;
}
......@@ -56,15 +56,16 @@ public:
virtual ~Texture(void)
{
// context 0 will get ignored by OpenGL
glDeleteTextures(1, &mContext);
// object name 0 will get ignored by OpenGL
glDeleteTextures(1, &mObjectName);
}
// ==================================================================================================== \/
// ============================================================================================ GETTERS \/
// ==================================================================================================== \/
public:
inline GLuint getContext (void) const { return mContext; }
inline GLuint operator() (void) const { return mObjectName; }
inline GLuint getObjectName (void) const { return mObjectName; }
inline GLenum getTarget (void) const { return mTarget; }
inline GLsizei getWidth (void) const { return mWidth; }
inline GLsizei getHeight (void) const { return mHeight; }
......@@ -83,14 +84,14 @@ public:
inline void bind(GLenum _textureUnit) const
{
glActiveTexture(GL_TEXTURE0 + _textureUnit);
glBindTexture(mTarget, mContext);
glBindTexture(mTarget, mObjectName);
openGLRareError();
}
//! Bind this texture.
inline void bind(void) const
{
glBindTexture(mTarget, mContext);
glBindTexture(mTarget, mObjectName);
openGLRareError();
}
......@@ -98,7 +99,7 @@ public:
inline void setMinFilter(GLint _value)
{
mMinFilter = _value;
glBindTexture(mTarget, mContext);
glBindTexture(mTarget, mObjectName);
glTexParameteri(mTarget, GL_TEXTURE_MIN_FILTER, mMinFilter);
openGLRareError();
}
......@@ -107,7 +108,7 @@ public:
inline void setMagFilter(GLint _value)
{
mMagFilter = _value;
glBindTexture(mTarget, mContext);
glBindTexture(mTarget, mObjectName);
glTexParameteri(mTarget, GL_TEXTURE_MAG_FILTER, mMagFilter);
openGLRareError();
}
......@@ -121,7 +122,7 @@ public:
glGetFloatv( GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &maxAnisotropicSamples );
_sampleCount = std::max( 1.0f, _sampleCount );
_sampleCount = std::min( maxAnisotropicSamples, _sampleCount );
glBindTexture(mTarget, mContext);
glBindTexture(mTarget, mObjectName);
glTexParameterf( mTarget, GL_TEXTURE_MAX_ANISOTROPY_EXT, _sampleCount);
openGLRareError();
} else
......@@ -232,7 +233,7 @@ public:
//! Set texture data
inline void setImageData2D(const GLvoid* _pData = NULL)
{
glBindTexture(mTarget, mContext);
glBindTexture(mTarget, mObjectName);
glTexImage2D(
mTarget,
0,
......@@ -260,7 +261,7 @@ public:
GLsizei _width = 0,
GLsizei _height = 0)
{
glBindTexture(mTarget, mContext);
glBindTexture(mTarget, mObjectName);
glTexImage2D(
mTarget,
_mipmapLevel,
......@@ -282,7 +283,7 @@ public:
int _width,
int _height)
{
glBindTexture(mTarget, mContext);
glBindTexture(mTarget, mObjectName);
glTexSubImage2D(
mTarget,
0,
......@@ -306,7 +307,7 @@ public:
int _height,
int _depth)
{
glBindTexture(mTarget, mContext);
glBindTexture(mTarget, mObjectName);
glTexSubImage3D(
mTarget,
0,
......@@ -325,7 +326,7 @@ public:
//! Note: The function is not const, because it changes the corresponding GPU data
void generateMipmaps(void)
{
glBindTexture(mTarget, mContext);
glBindTexture(mTarget, mObjectName);
#if (!defined ACGL_OPENGL_PROFILE_CORE)
// on some ATI systems texturing has to be enabled to generate MipMaps
// this is not needed by the spec an deprecated on core profiles (generates
......@@ -346,7 +347,7 @@ public:
// ============================================================================================ FIELDS \/
// =================================================================================================== \/
private:
GLuint mContext;
GLuint mObjectName;
GLenum mTarget;
GLsizei mWidth;
GLsizei mHeight;
......
......@@ -18,7 +18,7 @@ int_t ArrayBuffer::getAttributeIndexByName(const std::string& _nameInArray) cons
void ArrayBuffer::render(void) const
{
glBindBuffer(GL_ARRAY_BUFFER, mContext);
glBindBuffer(GL_ARRAY_BUFFER, mObjectName);
for(AttributeVec::size_type i = 0; i < mAttributes.size(); ++i)
{
setAttributePointer(i, i);
......
......@@ -46,8 +46,8 @@ bool Shader::setSource(const std::string& _source)
bool Shader::compile(const char* _pProgramText) const
{
glShaderSource(mContext, 1, &_pProgramText, NULL); // can't create OpenGL errors
glCompileShader(mContext);
glShaderSource(mObjectName, 1, &_pProgramText, NULL); // can't create OpenGL errors
glCompileShader(mObjectName);
#ifdef ACGL_CHECK_CRITICAL_GL_ERRORS
// problems with the shader creation are always a bad thing...
......@@ -55,13 +55,13 @@ bool Shader::compile(const char* _pProgramText) const
//
if ( openGLRareErrorOccured() )
{
error() << "glCompileShader failed, that can only mean, that the context used is not a valid shader object!" << std::endl;
error() << "glCompileShader failed, that can only mean, that the object name used is not a valid shader object!" << std::endl;
return false;
}
// check for shader compile errors:
GLint shaderError;
glGetShaderiv(mContext, GL_COMPILE_STATUS, &shaderError);
glGetShaderiv(mObjectName, GL_COMPILE_STATUS, &shaderError);
if(shaderError != GL_TRUE)
{
// yes, errors
......@@ -70,12 +70,12 @@ bool Shader::compile(const char* _pProgramText) const
// a log gets always printed (could be warnings)
GLsizei length = 0;
glGetShaderiv(mContext, GL_INFO_LOG_LENGTH, &length);
glGetShaderiv(mObjectName, GL_INFO_LOG_LENGTH, &length);
if(length > 1)
{
// a compile log can get produced even if there were no errors, but warnings!
GLchar* pInfo = new char[length + 1];
glGetShaderInfoLog(mContext, length, &length, pInfo);
glGetShaderInfoLog(mObjectName, length, &length, pInfo);
error() << "Compile log: " << std::string(pInfo) << std::endl;
delete[] pInfo;
}
......
......@@ -12,7 +12,7 @@ using namespace ACGL::Utils;
bool ShaderProgram::link(void) const
{
glLinkProgram(mContext);
glLinkProgram(mObjectName