[osg-users] Minor change proposal : Blacklist usage of all unsized texture internat format

Julien Valentin julienvalentin51 at gmail.com
Tue Aug 14 08:06:53 PDT 2018

I repose the problem:

Deductions when can do to help user setting its Texture (fill unsetted)
-Texture::_internalformat ->sourceFormat

glTexStorage only allow SIZED internalFormat whereas glTexImage allow both sized and unsized

Texture with Image already had glTexStorage support and there was no problem since _internalFormat is set based on a deduction from Image::_pixelFormat

I had glTexStorage for ImageLess Texture code path and now we see a problem: we don't have a _pixelFormat to deduce _intenalFoamt

One solution would be to add setup an other 'osg only' conventions to translate unsized to sized internalFormat.

Problem  would  be
-it add more convolution to understand what osg do with textures :/
-it could perhaps introduce divergence among diff hardware
(ex: I don't read anywhere that _internalFormat=GL_RGBA is understand as GL_RGBA8 or GL_RGBA16 on all machines)

So if noone have a better idea, my proposal is to simply to ban usage unsized _internalFormats. I think it would sanitize osg

Please, argue on this base

PS at Roberts: If you call my proposal backward compatibility breaking, I think it would involve less pain for user code maintanability than the change you've made on _textureunit,.. 
i had to debug to see i can't anymore put the same texture on differents textureunits (and lot of code change were involved:/)...
And I think I'm not the only one using this "niche feature"...


robertosfield wrote:
> Hi Jilien,
> My priority for the OpenSceneGraph is stability and backwards compatibility.
> So if you are suggesting that is something the breaks backwards
> compatibility/change behaviour then it's a problem.
> OpenSceneGraph and OpenGL have evolved together over nearly two
> decades, both are now in mature phase of their life.  New features of
> OpenGL/OpenSceneGraph can't break the old features that existing users
> are using.  Breaking old features just creates pain for users and more
> support work.
> So for this task rather than black listing the priority has to how to
> wokr out how to keep existing applications working without changes.
> Robert.
> On Tue, 14 Aug 2018 at 02:30, Julien Valentin
> <> wrote:
> > 
> > Hi,
> > 
> > the support for unsized internal format is quite oldish...
> > it's quite a miracle that calls to glTexImage2D still work with both internalformat (rawdatadescription) and format (memory layout) set to GL_RGBA
> > -How can GLknow what we want in that case? there's definitly a default sized internalformat for GL_RGBA ...-
> > 
> > In my sense
> > 
> > -unsized internal formats should not have been supported by osg at the first place.
> > 
> > -the argument 'format' in osg usage of glTexImage ( _sourceFormat ? _sourceFormat : _internalFormat) is completely wrong
> > (you can't substitute a format with a sizedinternalFormat, that's 2 different stuff)
> > 
> > 
> > In the case with image attached
> > we can deduce a proper _internalformat from Image::_pixelFormat (customisation of this behavior is the reason of being of _internalFormatMode),
> > 
> > In the case no image is setted  (_internalFormatMode==USE_USER_DEFINED_FORMAT)
> > we only can deduce format (_sourceFormat) and type(_internalFormatType) from a sized internalformat.
> > internalformat concernq GPUside representation and is mandatory to be specified by user.
> > 
> > My proposal would be
> > -to black list unsized format in order user code work both with the presence or not of glTexStorage
> > -to force user to set its own sourceFormat when no image attached
> > 
> > Is it so controversal?
> > 
> > Cheers,
> > Julien[/list]
> > 
> > ------------------------
> > Twirling twirling twirling toward freedom
> > 
> > ------------------
> > Read this topic online here:
> > http://forum.openscenegraph.org/viewtopic.php?p=74505#74505
> > 
> > 
> > 
> > 
> > 
> > _______________________________________________
> > osg-users mailing list
> > 
> > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> > 
> _______________________________________________
> osg-users mailing list
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>  ------------------
> Post generated by Mail2Forum

Twirling twirling twirling toward freedom

Read this topic online here:

More information about the osg-users mailing list