From f28783e22b5a1df0821351dc2ab414ac8522de8f Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 21 Nov 2003 13:45:40 +0000 Subject: [PATCH] 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. --- src/osg/Texture2D.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/osg/Texture2D.cpp b/src/osg/Texture2D.cpp index 8fa0086af..6ef102685 100644 --- a/src/osg/Texture2D.cpp +++ b/src/osg/Texture2D.cpp @@ -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);