Commit 94da98a3 authored by Robert Menzel's avatar Robert Menzel

setWrap methods of textures and samplers work the same now

parent 86468e94
......@@ -26,21 +26,8 @@ namespace OpenGL{
class Sampler {
ACGL_NOT_COPYABLE(Sampler)
public:
Sampler()
{
glGenSamplers(1, &mObjectName);
if (openGLCriticalErrorOccured() ) {
ACGL::Utils::error() << "could not generate sampler!" << std::endl;
mObjectName = 0;
return;
}
}
~Sampler(void)
{
// sampler 0 will get ignored by OpenGL
glDeleteSamplers(1, &mObjectName);
}
Sampler();
~Sampler(void);
// ==================================================================================================== \/
// ============================================================================================ GETTERS \/
......
......@@ -118,6 +118,10 @@ public:
openGLRareError();
}
void setWrapS( GLenum _wrapS = GL_REPEAT );
void setWrapT( GLenum _wrapT = GL_REPEAT );
void setWrapR( GLenum _wrapR = GL_REPEAT );
//! Note: The function is not const, because it changes the corresponding GPU data
void setWrap(GLenum _wrapS, GLenum _wrapT = 0, GLenum _wrapR = 0);
......
......@@ -7,6 +7,28 @@
using namespace ACGL::OpenGL;
void Texture::setWrapS( GLenum _wrapS )
{
glBindTexture(mTarget, mObjectName);
mWrapS = _wrapS;
glTexParameteri(mTarget, GL_TEXTURE_WRAP_S, mWrapS);
}
void Texture::setWrapT( GLenum _wrapT )
{
glBindTexture(mTarget, mObjectName);
mWrapT = _wrapT;
glTexParameteri(mTarget, GL_TEXTURE_WRAP_T, mWrapT);
}
void Texture::setWrapR( GLenum _wrapR )
{
glBindTexture(mTarget, mObjectName);
mWrapR = _wrapR;
glTexParameteri(mTarget, GL_TEXTURE_WRAP_R, mWrapR);
}
void Texture::setWrap( GLenum _wrapS, GLenum _wrapT, GLenum _wrapR )
{
glBindTexture(mTarget, mObjectName);
......
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