Added GL_RED and GL_RG support to _readColor()/Image::getColor();

This commit is contained in:
Robert Osfield
2018-05-18 13:53:39 +01:00
parent 880a100a60
commit 7602b868f4

View File

@@ -2140,6 +2140,8 @@ Vec4 _readColor(GLenum pixelFormat, T* data,float scale)
case(GL_DEPTH_COMPONENT): //intentionally fall through and execute the code for GL_LUMINANCE
case(GL_LUMINANCE): { float l = float(*data++)*scale; return Vec4(l, l, l, 1.0f); }
case(GL_ALPHA): { float a = float(*data++)*scale; return Vec4(1.0f, 1.0f, 1.0f, a); }
case(GL_RED): { float r = float(*data++)*scale; return Vec4(r, 1.0f, 1.0f, 1.0f); }
case(GL_RG): { float r = float(*data++)*scale; float g = float(*data++)*scale; return Vec4(r, g, 1.0f, 1.0f); }
case(GL_LUMINANCE_ALPHA): { float l = float(*data++)*scale; float a = float(*data++)*scale; return Vec4(l,l,l,a); }
case(GL_RGB): { float r = float(*data++)*scale; float g = float(*data++)*scale; float b = float(*data++)*scale; return Vec4(r,g,b,1.0f); }
case(GL_RGBA): { float r = float(*data++)*scale; float g = float(*data++)*scale; float b = float(*data++)*scale; float a = float(*data++)*scale; return Vec4(r,g,b,a); }