[osg-users] Setting a monochrome 2d texture from byte array

Glenn Waldron gwaldron at gmail.com
Wed Nov 6 05:33:43 PST 2019


Steve,
Just be aware that GL_LUMINANCE is long since deprecated and only available
in compatibility context.
GL_RED is the only 1-channel option available in modern OpenGL.

Glenn Waldron / osgEarth


On Tue, Nov 5, 2019 at 12:49 PM Steve Hardy <osgforum at tevs.eu> wrote:

> Hi,
>
> Thanks for the responses.  I tried Robert's initial suggestions, but they
> get
>
> Code:
> Warning: detected OpenGL error 'invalid value' at after RenderBin::draw(..)
>
>
> on my system.
>
> Glenn's suggestion basically worked, although the image was literally
> shades of red.  So I looked at the DefaultFont source, and tried GL_ALPHA.
> Maybe that would have worked if I turned alpha blending on etc.  So just
> for kicks I tried GL_LUMINANCE (for internal and pixel format) and it
> worked!
>
> So, for the record, here is what worked best for me:
>
>
> Code:
> img->setImage(w, h, 1, GL_LUMINANCE, GL_LUMINANCE, GL_UNSIGNED_BYTE, data,
> osg::Image::USE_MALLOC_FREE);     // works!
>
>
>
>
>
> Thank you!
>
> Cheers,
> Steve
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=76880#76880
>
>
>
>
>
> _______________________________________________
> 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/20191106/8c993af3/attachment.html>


More information about the osg-users mailing list