[osg-users] how to render 16bit depth image

Sebastian Messerschmidt sebastian.messerschmidt at gmx.de
Wed Jul 20 00:48:49 PDT 2016


Hi Bruno,
> Ok so I meant GL_ vars. Could you suggest any code for substituting 
> that setImage line? Thank you

To what end? You haven't told us, what you want to achieve, except from 
using integer.
If you want to fill it with 16bit integer values you probably need


internal: GL_R16UI
format: GL_RED_INTEGER
type: GL_UNSIGNED_SHORT

will give you a format, where the red channel is 16bit with unsigned 
values and your source type is unsigned short values.

Cheers
Sebastian

>
> On 19 Jul 2016, at 09:35, Sebastian Messerschmidt 
> <sebastian.messerschmidt at gmx.de 
> <mailto:sebastian.messerschmidt at gmx.de>> wrote:
>
>> Hi Bruno,
>>> Sorry but I didn't quite catch that.
>>> What do you mean by "but I thing you need to use GL_RGBA_INTEGER_EXT 
>>> as source"
>> The source type needs to be GL_RGBA_INTEGER_EXT afaik when using 
>> integer textures.
>>> Alternatively, how can I replace the macros in that setImage 
>>> function call?
>> Which macros? The GL_ are constants.
>>
>> Cheers
>> Sebastian
>>>
>>> 2016-07-19 8:45 GMT+01:00 Sebastian Messerschmidt 
>>> <sebastian.messerschmidt at gmx.de 
>>> <mailto:sebastian.messerschmidt at gmx.de>>:
>>>
>>>     Hi,
>>>
>>>     Your internal format needs to be 16bit per channel to I think,
>>>     so GL_UNSIGNED_INT_8_8_8_8_REV might be inappropriate.
>>>     GL_R16UI might do, but I thing you need to use
>>>     GL_RGBA_INTEGER_EXT as source. Alternatively you can use
>>>     GL_LUMINANCE with GL_LUMINACE16F.
>>>
>>>     What exactly are you doing with the image?
>>>
>>>     Cheers
>>>     Sebastian
>>>>     Hello,
>>>>
>>>>     I have a 16bit per channel, 4 channel, image. The format is
>>>>     short (uint16_t). Note that this image is scaled to the full
>>>>     16bit depth [0, 65536]
>>>>
>>>>
>>>>     I have this code that works well for a 8bit, 4 channel image:
>>>>
>>>>     osg::ref_ptr<osg::Image> image = new osg::Image();
>>>>      image->setImage(ImageSize, ImageSize,1,
>>>>     GL_RGBA8,
>>>>     GL_RGBA,
>>>>     GL_UNSIGNED_INT_8_8_8_8_REV,
>>>>     MyDataPtr,
>>>>     osg::Image::NO_DELETE);
>>>>
>>>>
>>>>
>>>>     Now I want to por this to 16bit depth.
>>>>     How is this done?
>>>>
>>>>     I tried
>>>>
>>>>      image->setImage(ImageSize, ImageSize,1,
>>>>     GL_RGBA16UI,
>>>>     GL_RGBA,
>>>>     GL_UNSIGNED_INT_8_8_8_8_REV,
>>>>     MyDataPtr,
>>>>     osg::Image::NO_DELETE);
>>>>
>>>>     But this yields all black textures. How can I do this without
>>>>     converting my 16bit image pixel data?
>>>>
>>>>
>>>>     _______________________________________________
>>>>     osg-users mailing list
>>>>     osg-users at lists.openscenegraph.org
>>>>     <mailto:osg-users at lists.openscenegraph.org>
>>>>     http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>>
>>>
>>>
>>>     _______________________________________________
>>>     osg-users mailing list
>>>     osg-users at lists.openscenegraph.org
>>>     <mailto:osg-users at lists.openscenegraph.org>
>>>     http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> osg-users mailing list
>>> osg-users at lists.openscenegraph.org
>>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>>
>> _______________________________________________
>> osg-users mailing list
>> osg-users at lists.openscenegraph.org 
>> <mailto:osg-users at lists.openscenegraph.org>
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20160720/d9ee9b4b/attachment-0003.htm>


More information about the osg-users mailing list