Hi Johannes,

On 10 November 2011 10:48, Johannes Baeuerle <[email protected]> wrote:
> The first problem is wrong value of the block size of etc1 textures in the 
> getCompressedSize call in Texture.cpp. With the current block size of 16 the 
> target application crashes with a GL_INVALID_VALUE.  The reason is that the 
> calculated size passed to OpenGL does not match the size of the passed 
> data(data pointer,texture width,texture height,spec of etc1).
> With a block size of 8 in the getCompressedSize call this error dissapears.

I haven't yet found a definitive statement on the block size, do you
know where I should look.  The best I found in my quick trawl of the
web was a code example that seemed to use a block size of 8, which
looks to agrees with you usage so I've gone ahead and merged this
change.

> The second problem is the handling of etc1 textures in the 
> glCompressedTexSubImage2D and glCopyTexSubImage2D calls. Per default the 
> current implementation  in Texture2D prefers to use subloads instead of 
> complete reloads. The problem here is that the description of the etc1 
> extension (see 
> http://www.khronos.org/registry/gles/extensions/OES/OES_compressed_ETC1_RGB8_texture.txt)
>  declares that etc1 textures throw an GL_INVALID_OPERATION when used in 
> subload calls:
>
>
>>     INVALID_OPERATION is generated by CompressedTexSubImage2D,
>>     TexSubImage2D, or CopyTexSubImage2D if the texture image level
>>     bound to target has internal format ETC1_RGB8_OES.

This code I don't think is appropriate in the form it is now as it
reapeats the applyTexImage2D_load(..) block that is provide just a few
lines below, and also when I searched for the expression "
INVALID_OPERATION is generated by CompressedTexSubImage2D" I got lots
of hits on opengl.org's extension registry, so it's certainly not just
ETC1_RGB8_OES that has this issue.

What I think is probably more appropriate is to have a method that
checks whether sub loading of compressed textures is supported,
osg::Image::supportsTextureSubloading() would probably be the most
appropriate place to put it, and then change the Textyure2D.cpp code
to:

  if (textureobject->isAllocated() && image->supportsTextureSubloading())
  {
      applyTextureImage2D_subload(...)
  }
else
{
     applyTextureImage2D_load(..)
}

Could you try such an approach and then send me the changes.

Thanks.
Robert.
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to