Implemented glReadPixels for the implementation-dependent format
Signed-off-by: Andrew Lewycky
Signed-off-by: Daniel Koch
Author: Nicolas Capens
git-svn-id: http://angleproject.googlecode.com/svn/trunk@119 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/libGLESv2/Context.cpp b/src/libGLESv2/Context.cpp
index ab93ba7..18335bc 100644
--- a/src/libGLESv2/Context.cpp
+++ b/src/libGLESv2/Context.cpp
@@ -1540,6 +1540,7 @@
unsigned char *source = (unsigned char*)lock.pBits;
unsigned char *dest = (unsigned char*)pixels;
+ unsigned short *dest16 = (unsigned short*)pixels;
for (int j = 0; j < rect.bottom - rect.top; j++)
{
@@ -1631,10 +1632,13 @@
default: UNREACHABLE();
}
break;
- case IMPLEMENTATION_COLOR_READ_FORMAT:
+ case GL_RGB: // IMPLEMENTATION_COLOR_READ_FORMAT
switch (type)
{
- case IMPLEMENTATION_COLOR_READ_TYPE:
+ case GL_UNSIGNED_SHORT_5_6_5: // IMPLEMENTATION_COLOR_READ_TYPE
+ dest16[i + j * width] = ((unsigned short)(31 * b + 0.5f) << 0) |
+ ((unsigned short)(63 * g + 0.5f) << 5) |
+ ((unsigned short)(31 * r + 0.5f) << 11);
break;
default: UNREACHABLE();
}