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

Steve Hardy osgforum at tevs.eu
Tue Nov 5 09:42:57 PST 2019


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







More information about the osg-users mailing list