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

clean up in texture (reduced duplicated code)

parent d9ad3dcc
......@@ -178,22 +178,18 @@ public:
}
//! Set texture data
inline void setImageData2D(const GLvoid* _pData = NULL)
inline void setImageData2D(
const GLvoid* _pData,
GLsizei _width,
GLsizei _height,
GLenum _internalFormat,
GLenum _format,
GLenum _type)
{
glBindTexture(mTarget, mContext);
glTexImage2D(
mTarget,
0,
mInternalFormat,
mWidth,
mHeight,
0,//no border
mFormat,
mType,
_pData);
if (openGLCriticalErrorOccured() ) {
ACGL::Utils::error() << "could not generate texture!d" << std::endl;
}
mInternalFormat = _internalFormat;
mFormat = _format;
mType = _type;
setImageData2D( _pData, _width, _height );
}
//! Set texture data
......@@ -202,35 +198,14 @@ public:
GLsizei _width,
GLsizei _height)
{
mWidth = _width;
mWidth = _width;
mHeight = _height;
glBindTexture(mTarget, mContext);
glTexImage2D(
mTarget,
0,
mInternalFormat,
mWidth,
mHeight,
0,//no border
mFormat,
mType,
_pData);
setImageData2D( _pData );
}
//! Set texture data
inline void setImageData2D(
const GLvoid* _pData,
GLsizei _width,
GLsizei _height,
GLenum _internalFormat,
GLenum _format,
GLenum _type)
inline void setImageData2D(const GLvoid* _pData = NULL)
{
mWidth = _width;
mHeight = _height;
mInternalFormat = _internalFormat;
mFormat = _format;
mType = _type;
glBindTexture(mTarget, mContext);
glTexImage2D(
mTarget,
......@@ -242,6 +217,9 @@ public:
mFormat,
mType,
_pData);
if (openGLCriticalErrorOccured() ) {
ACGL::Utils::error() << "could not generate texture!d" << std::endl;
}
}
//! Set texture data for some mipmap level.
......
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