[osg-users] Scaled Images with GL_RG Format

Daniel Emminizer, Code 5773 dan.emminizer at nrl.navy.mil
Tue Jun 26 11:46:33 PDT 2018


Hi Robert,

I have found a minor bug with image scaling.  I have a texture that is 1024x768 that is being resized to 1024x1024 for a Texture2D.  Texture::applyTexImage2D_load() detects the need to resize and tries to do so through gluScaleImage(), which is implemented in src/osg/glu/libutil/mipmap.cpp.

All that works great for most of my images, but this image is greyscale with alpha.  GL spec deprecates GL_LUMINANCE_ALPHA and requires use of GL_RG for these images types.  But the code in gluScaleImage() does not respect GL_RG (though it supports many other formats).

This patch treats GL_RG identically to GL_LUMINANCE; a simple 2 element format.

After this patch, my image shows up fine.  Mipmap.cpp supports many other similar types, like GL_RED.  Risk of this change seems pretty low.

PR is up at https://github.com/openscenegraph/OpenSceneGraph/pull/566

Thanks,

 - Dan



More information about the osg-users mailing list