Add support for OES_read_format. As soon as glext.h is updated with the
enums for this extension, the changes to gl.h can be removed.
This commit is contained in:
@@ -2226,6 +2226,17 @@ typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEATIPROC) (GLenum modeRGB, GLen
|
||||
#endif /* GL_ATI_blend_equation_separate */
|
||||
|
||||
|
||||
/* As soon as the official glext.h is updated to include this, it will be
|
||||
* removed from here.
|
||||
*/
|
||||
#ifndef GL_OES_read_format
|
||||
#define GL_OES_read_format 1
|
||||
|
||||
#define GL_IMPLEMENTATION_COLOR_READ_TYPE_OES 0x8B9A
|
||||
#define GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES 0x8B9B
|
||||
|
||||
#endif /* GL_OES_read_format */
|
||||
|
||||
/**
|
||||
** NOTE!!!!! If you add new functions to this file, or update
|
||||
** glext.h be sure to regenerate the gl_mangle.h file. See comments
|
||||
|
@@ -207,6 +207,8 @@ Key( unsigned char key, int x, int y )
|
||||
static void
|
||||
Init( GLboolean ciMode )
|
||||
{
|
||||
GLboolean have_read_format = GL_FALSE;
|
||||
|
||||
printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
|
||||
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
|
||||
|
||||
@@ -234,6 +236,20 @@ Init( GLboolean ciMode )
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef GL_OES_read_format
|
||||
if ( glutExtensionSupported( "GL_OES_read_format" ) ) {
|
||||
glGetIntegerv( GL_IMPLEMENTATION_COLOR_READ_TYPE_OES, & ReadType );
|
||||
glGetIntegerv( GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES, & ReadFormat );
|
||||
|
||||
have_read_format = GL_TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
printf( "GL_OES_read_format %ssupported. "
|
||||
"Using type / format = 0x%04x / 0x%04x\n",
|
||||
(have_read_format) ? "" : "not ",
|
||||
ReadType, ReadFormat );
|
||||
|
||||
printf("Loaded %d by %d image\n", ImgWidth, ImgHeight );
|
||||
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||
|
@@ -1114,6 +1114,9 @@ _mesa_init_constants( GLcontext *ctx )
|
||||
|
||||
ctx->Const.MaxDrawBuffers = MAX_DRAW_BUFFERS;
|
||||
|
||||
ctx->Const.ColorReadFormat = GL_RGBA;
|
||||
ctx->Const.ColorReadType = GL_UNSIGNED_BYTE;
|
||||
|
||||
/* sanity checks */
|
||||
ASSERT(ctx->Const.MaxTextureUnits == MAX2(ctx->Const.MaxTextureImageUnits, ctx->Const.MaxTextureCoordUnits));
|
||||
}
|
||||
|
@@ -141,6 +141,7 @@ static const struct {
|
||||
{ ON, "GL_NV_texgen_reflection", F(NV_texgen_reflection) },
|
||||
{ OFF, "GL_NV_vertex_program", F(NV_vertex_program) },
|
||||
{ OFF, "GL_NV_vertex_program1_1", F(NV_vertex_program1_1) },
|
||||
{ ON, "GL_OES_read_format", F(OES_read_format) },
|
||||
{ OFF, "GL_SGI_color_matrix", F(SGI_color_matrix) },
|
||||
{ OFF, "GL_SGI_color_table", F(SGI_color_table) },
|
||||
{ OFF, "GL_SGI_texture_color_table", F(SGI_texture_color_table) },
|
||||
|
@@ -1723,6 +1723,13 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
|
||||
}
|
||||
break;
|
||||
|
||||
case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES:
|
||||
*params = INT_TO_BOOL(ctx->Const.ColorReadType);
|
||||
return;
|
||||
case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES:
|
||||
*params = INT_TO_BOOL(ctx->Const.ColorReadFormat);
|
||||
return;
|
||||
|
||||
default:
|
||||
_mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv(pname=0x%x)", pname);
|
||||
}
|
||||
@@ -3317,6 +3324,13 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params )
|
||||
}
|
||||
break;
|
||||
|
||||
case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES:
|
||||
*params = (GLdouble) ctx->Const.ColorReadType;
|
||||
return;
|
||||
case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES:
|
||||
*params = (GLdouble) ctx->Const.ColorReadFormat;
|
||||
return;
|
||||
|
||||
default:
|
||||
_mesa_error(ctx, GL_INVALID_ENUM, "glGetDoublev(pname=0x%x)", pname);
|
||||
}
|
||||
@@ -4887,6 +4901,13 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
|
||||
}
|
||||
break;
|
||||
|
||||
case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES:
|
||||
*params = (GLfloat) ctx->Const.ColorReadType;
|
||||
return;
|
||||
case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES:
|
||||
*params = (GLfloat) ctx->Const.ColorReadFormat;
|
||||
return;
|
||||
|
||||
default:
|
||||
_mesa_error(ctx, GL_INVALID_ENUM, "glGetFloatv(0x%x)", pname);
|
||||
}
|
||||
@@ -6495,6 +6516,13 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
|
||||
}
|
||||
break;
|
||||
|
||||
case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES:
|
||||
*params = ctx->Const.ColorReadType;
|
||||
return;
|
||||
case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES:
|
||||
*params = ctx->Const.ColorReadFormat;
|
||||
return;
|
||||
|
||||
default:
|
||||
_mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv(pname=0x%x)", pname);
|
||||
}
|
||||
|
@@ -1913,6 +1913,9 @@ struct gl_constants
|
||||
GLboolean CheckArrayBounds;
|
||||
/* GL_ARB_draw_buffers */
|
||||
GLuint MaxDrawBuffers;
|
||||
/* GL_OES_read_format */
|
||||
GLenum ColorReadFormat;
|
||||
GLenum ColorReadType;
|
||||
};
|
||||
|
||||
|
||||
@@ -2015,6 +2018,7 @@ struct gl_extensions
|
||||
GLboolean NV_texture_rectangle;
|
||||
GLboolean NV_vertex_program;
|
||||
GLboolean NV_vertex_program1_1;
|
||||
GLboolean OES_read_format;
|
||||
GLboolean SGI_color_matrix;
|
||||
GLboolean SGI_color_table;
|
||||
GLboolean SGI_texture_color_table;
|
||||
|
Reference in New Issue
Block a user