From Farshid Lashkari, "I've updated the dds, png, and jpeg plugins to support writing images with the GL_DEPTH_COMPONENT pixel format. They will simply treat it the same as the GL_LUMINANCE pixel format."

This commit is contained in:
Robert Osfield
2013-06-21 08:37:47 +00:00
parent fe461c77fc
commit 4738a2607b
3 changed files with 3 additions and 0 deletions

View File

@@ -1147,6 +1147,7 @@ bool WriteDDSFile(const osg::Image *img, std::ostream& fout, bool autoFlipDDSWri
}
break;
case GL_LUMINANCE:
case GL_DEPTH_COMPONENT:
{
ddpf.dwRBitMask = 0x000000ff;
PF_flags |= DDPF_LUMINANCE;

View File

@@ -665,6 +665,7 @@ class ReaderWriterJPEG : public osgDB::ReaderWriter
int image_components = 3;
// Only cater for gray, alpha and RGB for now
switch(img.getPixelFormat()) {
case(GL_DEPTH_COMPONENT):
case(GL_LUMINANCE):
case(GL_ALPHA): {
image_color_space = JCS_GRAYSCALE;

View File

@@ -114,6 +114,7 @@ class ReaderWriterPNG : public osgDB::ReaderWriter
int bit_depth = img.getPixelSizeInBits();
switch(img.getPixelFormat()) {
case(GL_DEPTH_COMPONENT): color = PNG_COLOR_TYPE_GRAY; break;
case(GL_LUMINANCE): color = PNG_COLOR_TYPE_GRAY; break;
case(GL_ALPHA): color = PNG_COLOR_TYPE_GRAY; break; //Couldn't find a color type for pure alpha, using gray instead
case(GL_LUMINANCE_ALPHA): color = PNG_COLOR_TYPE_GRAY_ALPHA ; bit_depth /= 2; break;