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

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: ...@@ -68,14 +68,14 @@ public:
ArrayBuffer( ArrayBuffer(
GLenum _usage = GL_STATIC_DRAW, GLenum _usage = GL_STATIC_DRAW,
GLenum _mode = GL_TRIANGLES) GLenum _mode = GL_TRIANGLES)
: mContext(0), : mObjectName(0),
mUsage(_usage), mUsage(_usage),
mMode(_mode), mMode(_mode),
mElements(0), mElements(0),
mStride(0), mStride(0),
mAttributes() mAttributes()
{ {
glGenBuffers(1, &mContext); glGenBuffers(1, &mObjectName);
if (openGLCriticalErrorOccured() ) { if (openGLCriticalErrorOccured() ) {
ACGL::Utils::error() << "could not generate array buffer!" << std::endl; ACGL::Utils::error() << "could not generate array buffer!" << std::endl;
} }
...@@ -84,14 +84,15 @@ public: ...@@ -84,14 +84,15 @@ public:
virtual ~ArrayBuffer(void) virtual ~ArrayBuffer(void)
{ {
// buffer 0 will get ignored by OpenGL // buffer 0 will get ignored by OpenGL
glDeleteBuffers(1, &mContext); glDeleteBuffers(1, &mObjectName);
} }
// ==================================================================================================== \/ // ==================================================================================================== \/
// ============================================================================================ GETTERS \/ // ============================================================================================ GETTERS \/
// ==================================================================================================== \/ // ==================================================================================================== \/
public: 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 getUsage (void) const { return mUsage; }
inline GLenum getMode (void) const { return mMode; } inline GLenum getMode (void) const { return mMode; }
inline GLsizei getElements (void) const { return mElements; } inline GLsizei getElements (void) const { return mElements; }
...@@ -147,7 +148,7 @@ public: ...@@ -147,7 +148,7 @@ public:
//! Bind this buffer //! Bind this buffer
inline void bind(void) const inline void bind(void) const
{ {
glBindBuffer(GL_ARRAY_BUFFER, mContext); glBindBuffer(GL_ARRAY_BUFFER, mObjectName);
openGLRareError(); openGLRareError();
} }
...@@ -198,7 +199,7 @@ public: ...@@ -198,7 +199,7 @@ public:
//! Note: The function is not const, because it changes the corresponding GPU data //! Note: The function is not const, because it changes the corresponding GPU data
inline void setData(const GLvoid* _pData) inline void setData(const GLvoid* _pData)
{ {
glBindBuffer(GL_ARRAY_BUFFER, mContext); glBindBuffer(GL_ARRAY_BUFFER, mObjectName);
glBufferData( glBufferData(
GL_ARRAY_BUFFER, GL_ARRAY_BUFFER,
mStride * mElements, mStride * mElements,
...@@ -210,7 +211,7 @@ public: ...@@ -210,7 +211,7 @@ public:
// ============================================================================================ FIELDS \/ // ============================================================================================ FIELDS \/
// =================================================================================================== \/ // =================================================================================================== \/
protected: protected:
GLuint mContext; GLuint mObjectName;
GLenum mUsage; GLenum mUsage;
GLenum mMode; GLenum mMode;
GLsizei mElements; GLsizei mElements;
......
...@@ -43,14 +43,14 @@ public: ...@@ -43,14 +43,14 @@ public:
GLenum _usage = GL_STATIC_DRAW, GLenum _usage = GL_STATIC_DRAW,
GLenum _mode = GL_TRIANGLES, GLenum _mode = GL_TRIANGLES,
GLenum _type = GL_UNSIGNED_INT) GLenum _type = GL_UNSIGNED_INT)
: mContext(0), : mObjectName(0),
mUsage(_usage), mUsage(_usage),
mMode(_mode), mMode(_mode),
mElements(0), mElements(0),
mType(_type), mType(_type),
mSizeOfType(getGLTypeSize(_type)) mSizeOfType(getGLTypeSize(_type))
{ {
glGenBuffers(1, &mContext); glGenBuffers(1, &mObjectName);
if (openGLCriticalErrorOccured() ) { if (openGLCriticalErrorOccured() ) {
ACGL::Utils::error() << "could not generate element array buffer!" << std::endl; ACGL::Utils::error() << "could not generate element array buffer!" << std::endl;
} }
...@@ -60,14 +60,15 @@ public: ...@@ -60,14 +60,15 @@ public:
virtual ~ElementArrayBuffer(void) virtual ~ElementArrayBuffer(void)
{ {
// buffer 0 will get ignored by OpenGL // buffer 0 will get ignored by OpenGL
glDeleteBuffers(1, &mContext); glDeleteBuffers(1, &mObjectName);
} }
// ==================================================================================================== \/ // ==================================================================================================== \/
// ============================================================================================ GETTERS \/ // ============================================================================================ GETTERS \/
// ==================================================================================================== \/ // ==================================================================================================== \/
public: 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 getUsage (void) const { return mUsage; }
inline GLenum getMode (void) const { return mMode; } inline GLenum getMode (void) const { return mMode; }
inline GLsizei getElements (void) const { return mElements; } inline GLsizei getElements (void) const { return mElements; }
...@@ -94,7 +95,7 @@ public: ...@@ -94,7 +95,7 @@ public:
//! Bind this buffer //! Bind this buffer
inline void bind(void) const inline void bind(void) const
{ {
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mContext); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mObjectName);
} }
void draw(GLint _first, GLsizei _count) const void draw(GLint _first, GLsizei _count) const
...@@ -123,7 +124,7 @@ public: ...@@ -123,7 +124,7 @@ public:
inline void setData( inline void setData(
const GLvoid* _pData) const GLvoid* _pData)
{ {
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mContext); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mObjectName);
glBufferData( glBufferData(
GL_ELEMENT_ARRAY_BUFFER, GL_ELEMENT_ARRAY_BUFFER,
mElements * mSizeOfType, mElements * mSizeOfType,
...@@ -136,7 +137,7 @@ public: ...@@ -136,7 +137,7 @@ public:
// ============================================================================================ FIELDS \/ // ============================================================================================ FIELDS \/
// =================================================================================================== \/ // =================================================================================================== \/
protected: protected:
GLuint mContext; GLuint mObjectName;
GLenum mUsage; GLenum mUsage;
GLenum mMode; GLenum mMode;
GLsizei mElements; GLsizei mElements;
......
...@@ -70,12 +70,12 @@ public: ...@@ -70,12 +70,12 @@ public:
// ========================================================================================================= \/ // ========================================================================================================= \/
public: public:
FrameBufferObject(void) FrameBufferObject(void)
: mContext(0), : mObjectName(0),
mDrawBuffers(0), mDrawBuffers(0),
mColorAttachments(), mColorAttachments(),
mDepthAttachment() mDepthAttachment()
{ {
glGenFramebuffers(1, &mContext); glGenFramebuffers(1, &mObjectName);
if (openGLCriticalErrorOccured() ) { if (openGLCriticalErrorOccured() ) {
ACGL::Utils::error() << "could not generate FrameBufferObject!" << std::endl; ACGL::Utils::error() << "could not generate FrameBufferObject!" << std::endl;
return; return;
...@@ -88,14 +88,15 @@ public: ...@@ -88,14 +88,15 @@ public:
virtual ~FrameBufferObject(void) virtual ~FrameBufferObject(void)
{ {
// buffer 0 will get ignored by OpenGL // buffer 0 will get ignored by OpenGL
glDeleteFramebuffers(1, &mContext); glDeleteFramebuffers(1, &mObjectName);
} }
// ==================================================================================================== \/ // ==================================================================================================== \/
// ============================================================================================ GETTERS \/ // ============================================================================================ GETTERS \/
// ==================================================================================================== \/ // ==================================================================================================== \/
public: 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 AttachmentVec& getColorAttachments (void) const { return mColorAttachments; }
inline const Attachment& getDepthAttachment (void) const { return mDepthAttachment; } inline const Attachment& getDepthAttachment (void) const { return mDepthAttachment; }
...@@ -113,13 +114,13 @@ public: ...@@ -113,13 +114,13 @@ public:
*/ */
inline void bind(GLenum _type = GL_FRAMEBUFFER) const inline void bind(GLenum _type = GL_FRAMEBUFFER) const
{ {
glBindFramebuffer(_type, mContext); glBindFramebuffer(_type, mObjectName);
openGLRareError(); // glBindFramebuffer can only fail if the context is no valid FBO which shouldn't happen using this framework 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 inline void bindAsRenderTarget(GLenum _type = GL_FRAMEBUFFER) const
{ {
glBindFramebuffer(_type, mContext); glBindFramebuffer(_type, mObjectName);
glDrawBuffers(mDrawBuffers, msBuffers); glDrawBuffers(mDrawBuffers, msBuffers);
openGLRareError(); openGLRareError();
} }
...@@ -127,7 +128,7 @@ public: ...@@ -127,7 +128,7 @@ public:
/* /*
inline void bindAsRenderTarget(GLint _x, GLint _y, GLsizei _w, GLsizei _h, GLenum _type = GL_FRAMEBUFFER) const 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); glDrawBuffers(mDrawBuffers, msBuffers);
openGLRareError(); openGLRareError();
}*/ }*/
...@@ -144,7 +145,7 @@ public: ...@@ -144,7 +145,7 @@ public:
inline bool attachColorRenderBuffer(const std::string _name, const ConstSharedRenderBuffer& _renderBuffer) 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()) { if (openGLCommonErrorOccured()) {
Utils::error() << "Attaching of texture to the FBO failed" << std::endl; Utils::error() << "Attaching of texture to the FBO failed" << std::endl;
return false; return false;
...@@ -157,7 +158,7 @@ public: ...@@ -157,7 +158,7 @@ public:
inline bool attachColorTexture(const std::string _name, const ConstSharedTexture& _texture) 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()) { if (openGLCommonErrorOccured()) {
Utils::error() << "Attaching of texture to the FBO failed" << std::endl; Utils::error() << "Attaching of texture to the FBO failed" << std::endl;
return false; return false;
...@@ -170,15 +171,15 @@ public: ...@@ -170,15 +171,15 @@ public:
inline bool setDepthRenderBuffer(const ConstSharedRenderBuffer& _renderBuffer) 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 #ifdef ACGL_OPENGL_ES
if( _renderBuffer->getInternalFormat() == GL_DEPTH24_STENCIL8_OES || if( _renderBuffer->getInternalFormat() == GL_DEPTH24_STENCIL8_OES ||
_renderBuffer->getInternalFormat() == GL_DEPTH_STENCIL_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 #else
if( _renderBuffer->getInternalFormat() == GL_DEPTH24_STENCIL8 || if( _renderBuffer->getInternalFormat() == GL_DEPTH24_STENCIL8 ||
_renderBuffer->getInternalFormat() == GL_DEPTH_STENCIL) _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 #endif
mDepthAttachment.renderBuffer = _renderBuffer; mDepthAttachment.renderBuffer = _renderBuffer;
return true; return true;
...@@ -186,15 +187,15 @@ public: ...@@ -186,15 +187,15 @@ public:
inline bool setDepthTexture(const ConstSharedTexture& _texture) 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 #ifdef ACGL_OPENGL_ES
if( _texture->getInternalFormat() == GL_DEPTH24_STENCIL8_OES || if( _texture->getInternalFormat() == GL_DEPTH24_STENCIL8_OES ||
_texture->getInternalFormat() == GL_DEPTH_STENCIL_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 #else
if( _texture->getInternalFormat() == GL_DEPTH24_STENCIL8 || if( _texture->getInternalFormat() == GL_DEPTH24_STENCIL8 ||
_texture->getInternalFormat() == GL_DEPTH_STENCIL) _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 #endif
mDepthAttachment.texture = _texture; mDepthAttachment.texture = _texture;
return true; return true;
...@@ -204,7 +205,7 @@ public: ...@@ -204,7 +205,7 @@ public:
// ============================================================================================ FIELDS \/ // ============================================================================================ FIELDS \/
// =================================================================================================== \/ // =================================================================================================== \/
protected: protected:
GLuint mContext; GLuint mObjectName;
GLsizei mDrawBuffers; GLsizei mDrawBuffers;
AttachmentVec mColorAttachments; AttachmentVec mColorAttachments;
Attachment mDepthAttachment; // depth and stencil are combined Attachment mDepthAttachment; // depth and stencil are combined
......
...@@ -27,12 +27,12 @@ class RenderBuffer ...@@ -27,12 +27,12 @@ class RenderBuffer
public: public:
RenderBuffer( RenderBuffer(
GLenum _internalFormat) GLenum _internalFormat)
: mContext(0), : mObjectName(0),
mInternalFormat(_internalFormat), mInternalFormat(_internalFormat),
mWidth(0), mWidth(0),
mHeight(0) mHeight(0)
{ {
glGenRenderbuffers(1, &mContext); glGenRenderbuffers(1, &mObjectName);
if (openGLCriticalErrorOccured() ) { if (openGLCriticalErrorOccured() ) {
ACGL::Utils::error() << "could not generate renderbuffer!" << std::endl; ACGL::Utils::error() << "could not generate renderbuffer!" << std::endl;
return; return;
...@@ -42,14 +42,15 @@ public: ...@@ -42,14 +42,15 @@ public:
virtual ~RenderBuffer(void) virtual ~RenderBuffer(void)
{ {
// buffer 0 will get ignored by OpenGL // buffer 0 will get ignored by OpenGL
glDeleteRenderbuffers(1, &mContext); glDeleteRenderbuffers(1, &mObjectName);
} }
// ==================================================================================================== \/ // ==================================================================================================== \/
// ============================================================================================ GETTERS \/ // ============================================================================================ GETTERS \/
// ==================================================================================================== \/ // ==================================================================================================== \/
public: 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 GLenum getInternalFormat (void) const { return mInternalFormat; }
inline GLsizei getWidth (void) const { return mWidth; } inline GLsizei getWidth (void) const { return mWidth; }
inline GLsizei getHeight (void) const { return mHeight; } inline GLsizei getHeight (void) const { return mHeight; }
...@@ -61,7 +62,7 @@ public: ...@@ -61,7 +62,7 @@ public:
//! Bind the renderbuffer //! Bind the renderbuffer
inline void bind(void) const inline void bind(void) const
{ {
glBindRenderbuffer(GL_RENDERBUFFER, mContext); glBindRenderbuffer(GL_RENDERBUFFER, mObjectName);
} }
//! Set texture size and NULL data //! Set texture size and NULL data
...@@ -71,7 +72,7 @@ public: ...@@ -71,7 +72,7 @@ public:
{ {
mWidth = _width; mWidth = _width;
mHeight = _height; mHeight = _height;
glBindRenderbuffer(GL_RENDERBUFFER, mContext); glBindRenderbuffer(GL_RENDERBUFFER, mObjectName);
glRenderbufferStorage(GL_RENDERBUFFER, mInternalFormat, mWidth, mHeight); glRenderbufferStorage(GL_RENDERBUFFER, mInternalFormat, mWidth, mHeight);
} }
...@@ -79,7 +80,7 @@ public: ...@@ -79,7 +80,7 @@ public:
// ============================================================================================ FIELDS \/ // ============================================================================================ FIELDS \/
// =================================================================================================== \/ // =================================================================================================== \/
protected: protected:
GLuint mContext; GLuint mObjectName;
GLenum mInternalFormat; GLenum mInternalFormat;
GLsizei mWidth; GLsizei mWidth;
GLsizei mHeight; GLsizei mHeight;
......
...@@ -36,24 +36,25 @@ class Shader ...@@ -36,24 +36,25 @@ class Shader
// ========================================================================================================= \/ // ========================================================================================================= \/
public: public:
Shader(GLenum _type) Shader(GLenum _type)
: mContext(0), : mObjectName(0),
mType(_type) mType(_type)
{ {
mContext = glCreateShader(mType); mObjectName = glCreateShader(mType);
} }
virtual ~Shader(void) virtual ~Shader(void)
{ {
// "DeleteShader will silently ignore the value zero." - GL Spec // "DeleteShader will silently ignore the value zero." - GL Spec
glDeleteShader(mContext); glDeleteShader(mObjectName);
} }
// ==================================================================================================== \/ // ==================================================================================================== \/
// ============================================================================================ GETTERS \/ // ============================================================================================ GETTERS \/
// ==================================================================================================== \/ // ==================================================================================================== \/
public: public:
inline GLuint getContext (void) const { return mContext; } inline GLuint operator() (void) const { return mObjectName; }
inline GLenum getType (void) const { return mType; } inline GLuint getObjectName(void) const { return mObjectName; }
inline GLenum getType (void) const { return mType; }
// ==================================================================================================== \/ // ==================================================================================================== \/
// ============================================================================================ METHODS \/ // ============================================================================================ METHODS \/
...@@ -69,7 +70,7 @@ protected: ...@@ -69,7 +70,7 @@ protected:
// ============================================================================================ FIELDS \/ // ============================================================================================ FIELDS \/
// =================================================================================================== \/ // =================================================================================================== \/
protected: protected:
GLuint mContext; GLuint mObjectName;
GLenum mType; GLenum mType;
}; };
......
...@@ -69,42 +69,43 @@ public: ...@@ -69,42 +69,43 @@ public:
// ========================================================================================================= \/ // ========================================================================================================= \/
public: public:
ShaderProgram(void) ShaderProgram(void)
: mContext(0), : mObjectName(0),
mShaders() mShaders()
{ {
mContext = glCreateProgram(); mObjectName = glCreateProgram();
} }
virtual ~ShaderProgram(void) virtual ~ShaderProgram(void)
{ {
// "DeleteProgram will silently ignore the value zero." - GL Spec // "DeleteProgram will silently ignore the value zero." - GL Spec
glDeleteProgram(mContext); glDeleteProgram(mObjectName);
} }
// ==================================================================================================== \/ // ==================================================================================================== \/
// ============================================================================================ GETTERS \/ // ============================================================================================ GETTERS \/
// ==================================================================================================== \/ // ==================================================================================================== \/
public: public:
inline GLuint getContext (void) const { return mContext; } inline GLuint operator() (void) const { return mObjectName; }
inline const ConstSharedShaderVec& getShaders (void) const { return mShaders; } inline GLuint getObjectName(void) const { return mObjectName; }
inline const ConstSharedShaderVec& getShaders (void) const { return mShaders; }
// ===================================================================================================== \/ // ===================================================================================================== \/
// ============================================================================================ WRAPPERS \/ // ============================================================================================ WRAPPERS \/
// ===================================================================================================== \/ // ===================================================================================================== \/
public: 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) #if (ACGL_OPENGL_VERSION >= 30)
inline GLint getAttributeLocation (const std::string& _nameInShader) const { return glGetAttribLocation (mContext, _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(mContext, _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 (mContext, _location, _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 (mContext, _location, _nameInShader.c_str()); } inline void bindFragmentDataLocation (const std::string& _nameInShader, GLuint _location) const { glBindFragDataLocation (mObjectName, _location, _nameInShader.c_str()); }
#endif #endif
inline void use(void) const { glUseProgram(mContext); } inline void use(void) const { glUseProgram(mObjectName); }
inline void attachShader(const ConstSharedShader& _shader) inline void attachShader(const ConstSharedShader& _shader)
{ {
mShaders.push_back(_shader); mShaders.push_back(_shader);
glAttachShader(mContext, _shader->getContext()); glAttachShader( mObjectName, _shader->getObjectName() );
} }
bool link (void) const;