From Romano J M Silva, changed osg::Texture2D::copyTexImage2D so that it uses the

_internalFormat for the texture format to read rather than default to GL_RGBA.

From Robert Osfield, changed the osg::Texture2D::copyTexImage2D and copyTexSubImage
code so that it set the _internalFormat to GL_RGBA if is is zero.
This commit is contained in:
Robert Osfield
2003-11-21 13:45:40 +00:00
parent 62c955fa19
commit f28783e22b

View File

@@ -214,6 +214,8 @@ void Texture2D::computeInternalFormat() const
void Texture2D::copyTexImage2D(State& state, int x, int y, int width, int height )
{
const unsigned int contextID = state.getContextID();
if (_internalFormat==0) _internalFormat=GL_RGBA;
// get the globj for the current contextID.
TextureObject* textureObject = getTextureObject(contextID);
@@ -252,7 +254,7 @@ void Texture2D::copyTexImage2D(State& state, int x, int y, int width, int height
textureObject->bind();
applyTexParameters(GL_TEXTURE_2D,state);
glCopyTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, x, y, width, height, 0 );
glCopyTexImage2D( GL_TEXTURE_2D, 0, _internalFormat, x, y, width, height, 0 );
_textureWidth = width;
_textureHeight = height;
@@ -269,6 +271,8 @@ void Texture2D::copyTexSubImage2D(State& state, int xoffset, int yoffset, int x,
{
const unsigned int contextID = state.getContextID();
if (_internalFormat==0) _internalFormat=GL_RGBA;
// get the texture object for the current contextID.
TextureObject* textureObject = getTextureObject(contextID);