[osg-users] Creating Texture2DArray

Bruno Oliveira bruno.manata.oliveira at gmail.com
Fri Oct 21 06:54:53 PDT 2016


Thanks. However, I am already doing that!

2016-10-21 14:51 GMT+01:00 Glenn Waldron <gwaldron at gmail.com>:

> Bruno,
> According to this thread you might also need to set your packing to 1 (in
> the image->setImage call).
> (https://goo.gl/1pv2Zt)
>
> Just a guess.
>
> Glenn Waldron
>
> On Fri, Oct 21, 2016 at 9:36 AM, Bruno Oliveira <
> bruno.manata.oliveira at gmail.com> wrote:
>
>> Thanks for the answer.
>>
>> Using GL_LUMINANCE8UI yields undefined symbol. The closest symbols I have
>> defined is GL_LUMINANCE8UI_EXT.
>>
>> However, using internal TExture Format as GL_LUMINANCE8UI_EXT and pixel
>> format GL_LUMINANCE yields  'invalid operation' errors
>>
>> 2016-10-21 14:03 GMT+01:00 Sebastian Messerschmidt <
>> sebastian.messerschmidt at gmx.de>:
>>
>>> Hi Bruno,
>>>
>>>
>>>
>>>
>>> How do I guarantee that my textures will be unsigned integer 8bit texels
>>>> with no scaling nor normalization to float or whatsoever? Because using
>>>> GL_LUMINANCE is distupring my textures
>>>>
>>>
>>> GL_LUMINANCE8UI should do the trick. You need use a the correct
>>> sampler/data-type in the shader too (usampler and uvec)
>>>
>>> Cheers
>>> Sebatian
>>>
>>>
>>>> 2016-10-21 13:47 GMT+01:00 Glenn Waldron <gwaldron at gmail.com
>>>> <mailto:gwaldron at gmail.com>>:
>>>>
>>>>     I mean that GL_LUMINANCE is a valid pixel format, and GL_LUMINANCE8
>>>>     is an internal format. GL_LUMINANCE8 is not a valid pixel format and
>>>>     will probably give you a invalid enumerant error.
>>>>
>>>>
>>>>
>>>>     Glenn Waldron
>>>>
>>>>     On Fri, Oct 21, 2016 at 8:03 AM, Bruno Oliveira
>>>>     <bruno.manata.oliveira at gmail.com
>>>>     <mailto:bruno.manata.oliveira at gmail.com>> wrote:
>>>>
>>>>         Sorry Glenn what do you mean by "those reserved"?
>>>>
>>>>
>>>>         By the way, my intention is to pass uchar textures of fixed
>>>>         size, to perform texelFetch and bitwise operations inside a
>>>>         shader, so I really need my textures to be in the exact format
>>>>         of unsigned byte integer, single channel!
>>>>
>>>>         2016-10-21 12:25 GMT+01:00 Glenn Waldron <gwaldron at gmail.com
>>>>         <mailto:gwaldron at gmail.com>>:
>>>>
>>>>             Bruno, I think you have those reversed.
>>>>
>>>>
>>>>             On Oct 21, 2016 6:07 AM, "Bruno Oliveira"
>>>>             <bruno.manata.oliveira at gmail.com
>>>>             <mailto:bruno.manata.oliveira at gmail.com>> wrote:
>>>>
>>>>                 Hello,
>>>>
>>>>                 thank you for your answer. I am indeed using the same
>>>>                 texture sizes and formats.
>>>>                 If I use GL_LUMINANCE8 as pixelFormat and GL_LUMINANCE
>>>>                 as internalFormat, I get a "invalid enumerant" error
>>>>
>>>>                 2016-10-21 7:56 GMT+01:00 Sebastian Messerschmidt
>>>>                 <sebastian.messerschmidt at gmx.de
>>>>                 <mailto:sebastian.messerschmidt at gmx.de>>:
>>>>
>>>>
>>>>
>>>>                     Hi Bruno:
>>>>                     Sorry for not reading to the end:
>>>>
>>>>                         Hello,
>>>>
>>>>                         I'm trying to create a Texture2DArray. My
>>>>                         textures are uchar images with
>>>>                         size (texWidth, 256), single channel. The
>>>>                         combination of texture
>>>>                         internalFormat and pixelFormat with pixelType is
>>>>                         not working. I use
>>>>                         GL_R8UI for internalFormat, GL_RED_INTEGER for
>>>>                         pixelFormat and
>>>>                         GL_UNSIGNED_BYTE for type. This yields the
>>>>                         following error when I try to
>>>>                         render my scene:
>>>>
>>>>                         /Warning: detected OpenGL error 'invalid
>>>>                         enumerant' at after
>>>>                         RenderBin::draw(..)/
>>>>
>>>>                         However, if I use GL_LUMINANCE for
>>>>                         internalFormat and also GL_LUMINANCE
>>>>                         for pixelFormat, I get no errors but my textures
>>>>                         are not correctly
>>>>                         sized. WHat formats should I use here?
>>>>
>>>>                     When using GL_LUMINCANE as internal formet the
>>>>                     pixlel format needs to be
>>>>                     GL_LUMINANCE4/8/12/16[F/I/UI] ...
>>>>
>>>>                     So basically for default precision (GL_BYTE) it
>>>>                     should be
>>>>
>>>>                     GL_LUMINANCE8
>>>>
>>>>
>>>>                     Cheers
>>>>                     Sebastian
>>>>
>>>>
>>>>                         This is my code:
>>>>
>>>>
>>>>
>>>>                         osg::ref_ptr<osg::Texture2DArray> texture = new
>>>>                         osg::Texture2DArray;
>>>>                         texture->setFilter(osg::Textur
>>>> e2DArray::MIN_FILTER,
>>>>                         osg::Texture2DArray::LINEAR);
>>>>                         texture->setFilter(osg::Textur
>>>> e2DArray::MAG_FILTER,
>>>>                         osg::Texture2DArray::LINEAR);
>>>>                         texture->setWrap(osg::Texture2DArray::WRAP_R,
>>>>                         osg::Texture2DArray::REPEAT);
>>>>                          texture->setInternalFormat(*textureFormat()*);
>>>>
>>>>
>>>>                         // Add some images as follows:
>>>>                         for (...) {
>>>>
>>>>                          osg::Image* image = new osg::Image;
>>>>                         image->setImage(texWidth, 256, 1,
>>>>                         *textureFormat(), pixelFormat(),
>>>>                         type(),* dataPtr);
>>>>
>>>>                         texture->setImage(i, image);
>>>>                         }
>>>>
>>>>
>>>>                         I am using:
>>>>                         textureFormat() = GL_R8UI;
>>>>                         pixelFormat() = GL_RED_INTEGER;
>>>>                         type() = GL_UNSIGNED_BYTE
>>>>
>>>>
>>>>                         _______________________________________________
>>>>                         osg-users mailing list
>>>>                         osg-users at lists.openscenegraph.org
>>>>                         <mailto:osg-users at lists.openscenegraph.org>
>>>>                         http://lists.openscenegraph.or
>>>> g/listinfo.cgi/osg-users-openscenegraph.org
>>>>                         <http://lists.openscenegraph.o
>>>> rg/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.or
>>>> g/listinfo.cgi/osg-users-openscenegraph.org
>>>>                     <http://lists.openscenegraph.o
>>>> rg/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.or
>>>> g/listinfo.cgi/osg-users-openscenegraph.org
>>>>                 <http://lists.openscenegraph.o
>>>> rg/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.or
>>>> g/listinfo.cgi/osg-users-openscenegraph.org
>>>>             <http://lists.openscenegraph.o
>>>> rg/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-opens
>>>> cenegraph.org
>>>>         <http://lists.openscenegraph.org/listinfo.cgi/osg-users-open
>>>> scenegraph.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-opens
>>>> cenegraph.org
>>>>     <http://lists.openscenegraph.org/listinfo.cgi/osg-users-open
>>>> scenegraph.org>
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> osg-users mailing list
>>>> osg-users at lists.openscenegraph.org
>>>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-opens
>>>> cenegraph.org
>>>>
>>>> _______________________________________________
>>> osg-users mailing list
>>> osg-users at lists.openscenegraph.org
>>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-opens
>>> cenegraph.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
> 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/20161021/ea008e82/attachment-0003.htm>


More information about the osg-users mailing list