From Johannes Baeurele, "The osg::Image class now contains a 'supportsTextureSubloading()' method that is used inside the Texture2D::apply method. For now it only checks for the etc1 format in which case it returns 'false'. All other formats lead to a return value of 'true'.
Without the change the application does not work properly. First I get the notification that an OpenGL error occured. After some more of this error messages I see broken textures on the screen. With the changes attached to this message my application works as intended." Note from Robert Osfield, changed the Image::supportsTextureSubloading() to be const and to be implemented in the .cpp rather than inline.
This commit is contained in:
@@ -92,6 +92,10 @@
|
||||
#define GL_UNPACK_IMAGE_HEIGHT 0x806E
|
||||
#endif
|
||||
|
||||
#ifndef GL_OES_compressed_ETC1_RGB8_texture
|
||||
#define GL_ETC1_RGB8_OES 0x8D64
|
||||
#endif
|
||||
|
||||
namespace osg {
|
||||
|
||||
// forward declare
|
||||
@@ -396,6 +400,9 @@ class OSG_EXPORT Image : public BufferData
|
||||
return _data+getMipmapOffset(mipmapLevel);
|
||||
}
|
||||
|
||||
/** returns false for texture formats that do not support texture subloading */
|
||||
bool supportsTextureSubloading() const;
|
||||
|
||||
/** Return true if this image is translucent - i.e. it has alpha values that are less 1.0 (when normalized). */
|
||||
virtual bool isImageTranslucent() const;
|
||||
|
||||
|
||||
@@ -1431,6 +1431,17 @@ void Image::ensureValidSizeForTexturing(GLint maxTextureSize)
|
||||
}
|
||||
}
|
||||
|
||||
bool Image::supportsTextureSubloading() const
|
||||
{
|
||||
switch(_internalTextureFormat)
|
||||
{
|
||||
case GL_ETC1_RGB8_OES:
|
||||
return false;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template <typename T>
|
||||
bool _findLowerAlphaValueInRow(unsigned int num, T* data,T value, unsigned int delta)
|
||||
|
||||
@@ -247,7 +247,7 @@ void Texture2D::apply(State& state) const
|
||||
|
||||
applyTexParameters(GL_TEXTURE_2D,state);
|
||||
|
||||
if (textureObject->isAllocated())
|
||||
if (textureObject->isAllocated() && image->supportsTextureSubloading())
|
||||
{
|
||||
//OSG_NOTICE<<"Reusing texture object"<<std::endl;
|
||||
applyTexImage2D_subload(state,GL_TEXTURE_2D,image.get(),
|
||||
|
||||
Reference in New Issue
Block a user