📄 extensions.c
字号:
ctx->Extensions.NV_point_sprite = GL_TRUE;
ctx->Extensions.NV_texture_rectangle = GL_TRUE;
/*ctx->Extensions.NV_texgen_reflection = GL_TRUE;*/
#if FEATURE_NV_vertex_program
ctx->Extensions.NV_vertex_program = GL_TRUE;
ctx->Extensions.NV_vertex_program1_1 = GL_TRUE;
#endif
#if FEATURE_NV_fragment_program
ctx->Extensions.NV_fragment_program = GL_TRUE;
#endif
ctx->Extensions.SGI_color_matrix = GL_TRUE;
ctx->Extensions.SGI_color_table = GL_TRUE;
ctx->Extensions.SGI_texture_color_table = GL_TRUE;
ctx->Extensions.SGIS_generate_mipmap = GL_TRUE;
ctx->Extensions.SGIS_pixel_texture = GL_TRUE;
ctx->Extensions.SGIS_texture_edge_clamp = GL_TRUE;
ctx->Extensions.SGIX_depth_texture = GL_TRUE;
ctx->Extensions.SGIX_pixel_texture = GL_TRUE;
ctx->Extensions.SGIX_shadow = GL_TRUE;
ctx->Extensions.SGIX_shadow_ambient = GL_TRUE;
}
/**
* Enable GL_ARB_imaging and all the EXT extensions that are subsets of it.
*/
void
_mesa_enable_imaging_extensions(GLcontext *ctx)
{
ctx->Extensions.ARB_imaging = GL_TRUE;
ctx->Extensions.EXT_blend_color = GL_TRUE;
ctx->Extensions.EXT_blend_minmax = GL_TRUE;
ctx->Extensions.EXT_blend_subtract = GL_TRUE;
ctx->Extensions.EXT_convolution = GL_TRUE;
ctx->Extensions.EXT_histogram = GL_TRUE;
ctx->Extensions.SGI_color_matrix = GL_TRUE;
ctx->Extensions.SGI_color_table = GL_TRUE;
}
/**
* Enable all OpenGL 1.3 features and extensions.
* A convenience function to be called by drivers.
*/
void
_mesa_enable_1_3_extensions(GLcontext *ctx)
{
ctx->Extensions.ARB_multisample = GL_TRUE;
ctx->Extensions.ARB_multitexture = GL_TRUE;
ctx->Extensions.ARB_texture_border_clamp = GL_TRUE;
ctx->Extensions.ARB_texture_compression = GL_TRUE;
ctx->Extensions.ARB_texture_cube_map = GL_TRUE;
ctx->Extensions.ARB_texture_env_combine = GL_TRUE;
ctx->Extensions.ARB_texture_env_dot3 = GL_TRUE;
ctx->Extensions.EXT_texture_env_add = GL_TRUE;
/*ctx->Extensions.ARB_transpose_matrix = GL_TRUE;*/
}
/**
* Enable all OpenGL 1.4 features and extensions.
* A convenience function to be called by drivers.
*/
void
_mesa_enable_1_4_extensions(GLcontext *ctx)
{
ctx->Extensions.ARB_depth_texture = GL_TRUE;
ctx->Extensions.ARB_shadow = GL_TRUE;
ctx->Extensions.ARB_texture_env_crossbar = GL_TRUE;
ctx->Extensions.ARB_texture_mirrored_repeat = GL_TRUE;
ctx->Extensions.ARB_window_pos = GL_TRUE;
ctx->Extensions.EXT_blend_color = GL_TRUE;
ctx->Extensions.EXT_blend_func_separate = GL_TRUE;
ctx->Extensions.EXT_blend_logic_op = GL_TRUE;
ctx->Extensions.EXT_blend_minmax = GL_TRUE;
ctx->Extensions.EXT_blend_subtract = GL_TRUE;
ctx->Extensions.EXT_fog_coord = GL_TRUE;
ctx->Extensions.EXT_multi_draw_arrays = GL_TRUE;
ctx->Extensions.EXT_point_parameters = GL_TRUE;
ctx->Extensions.EXT_secondary_color = GL_TRUE;
ctx->Extensions.EXT_stencil_wrap = GL_TRUE;
ctx->Extensions.EXT_texture_lod_bias = GL_TRUE;
ctx->Extensions.SGIS_generate_mipmap = GL_TRUE;
}
/**
* Enable all OpenGL 1.5 features and extensions.
* A convenience function to be called by drivers.
*/
void
_mesa_enable_1_5_extensions(GLcontext *ctx)
{
ctx->Extensions.ARB_occlusion_query = GL_TRUE;
ctx->Extensions.ARB_vertex_buffer_object = GL_TRUE;
ctx->Extensions.EXT_shadow_funcs = GL_TRUE;
}
/**
* Enable all OpenGL 2.0 features and extensions.
* A convenience function to be called by drivers.
*/
void
_mesa_enable_2_0_extensions(GLcontext *ctx)
{
ctx->Extensions.ARB_draw_buffers = GL_TRUE;
#if 0 && FEATURE_ARB_fragment_shader
ctx->Extensions.ARB_fragment_shader = GL_TRUE;
#endif
ctx->Extensions.ARB_point_sprite = GL_TRUE;
ctx->Extensions.ARB_texture_non_power_of_two = GL_TRUE;
#if 0 && FEATURE_ARB_shader_objects
ctx->Extensions.ARB_shader_objects = GL_TRUE;
#endif
#if 0 && FEATURE_ARB_shading_language_100
ctx->Extensions.ARB_shading_language_100 = GL_TRUE;
#endif
ctx->Extensions.EXT_stencil_two_side = GL_TRUE;
#if 0 && FEATURE_ARB_vertex_shader
ctx->Extensions.ARB_vertex_shader = GL_TRUE;
#endif
}
/**
* Either enable or disable the named extension.
*/
static void
set_extension( GLcontext *ctx, const char *name, GLboolean state )
{
GLboolean *base = (GLboolean *) &ctx->Extensions;
GLuint i;
if (ctx->Extensions.String) {
/* The string was already queried - can't change it now! */
_mesa_problem(ctx, "Trying to enable/disable extension after glGetString(GL_EXTENSIONS): %s", name);
return;
}
for (i = 0 ; i < Elements(default_extensions) ; i++) {
if (_mesa_strcmp(default_extensions[i].name, name) == 0) {
if (default_extensions[i].flag_offset) {
GLboolean *enabled = base + default_extensions[i].flag_offset;
*enabled = state;
}
return;
}
}
_mesa_problem(ctx, "Trying to enable unknown extension: %s", name);
}
/**
* Enable the named extension.
* Typically called by drivers.
*/
void
_mesa_enable_extension( GLcontext *ctx, const char *name )
{
set_extension(ctx, name, GL_TRUE);
}
/**
* Disable the named extension.
* XXX is this really needed???
*/
void
_mesa_disable_extension( GLcontext *ctx, const char *name )
{
set_extension(ctx, name, GL_FALSE);
}
/**
* Test if the named extension is enabled in this context.
*/
GLboolean
_mesa_extension_is_enabled( GLcontext *ctx, const char *name )
{
const GLboolean *base = (const GLboolean *) &ctx->Extensions;
GLuint i;
for (i = 0 ; i < Elements(default_extensions) ; i++) {
if (_mesa_strcmp(default_extensions[i].name, name) == 0) {
if (!default_extensions[i].flag_offset)
return GL_TRUE;
return *(base + default_extensions[i].flag_offset);
}
}
return GL_FALSE;
}
/**
* Run through the default_extensions array above and set the
* ctx->Extensions.ARB/EXT_* flags accordingly.
* To be called during context initialization.
*/
void
_mesa_init_extensions( GLcontext *ctx )
{
GLboolean *base = (GLboolean *) &ctx->Extensions;
GLuint i;
for (i = 0 ; i < Elements(default_extensions) ; i++) {
if (default_extensions[i].enabled &&
default_extensions[i].flag_offset) {
*(base + default_extensions[i].flag_offset) = GL_TRUE;
}
}
}
/**
* Construct the GL_EXTENSIONS string. Called the first time that
* glGetString(GL_EXTENSIONS) is called.
*/
GLubyte *
_mesa_make_extension_string( GLcontext *ctx )
{
const GLboolean *base = (const GLboolean *) &ctx->Extensions;
GLuint extStrLen = 0;
GLubyte *s;
GLuint i;
/* first, compute length of the extension string */
for (i = 0 ; i < Elements(default_extensions) ; i++) {
if (!default_extensions[i].flag_offset ||
*(base + default_extensions[i].flag_offset)) {
extStrLen += (GLuint)_mesa_strlen(default_extensions[i].name) + 1;
}
}
s = (GLubyte *) _mesa_malloc(extStrLen);
/* second, build the extension string */
extStrLen = 0;
for (i = 0 ; i < Elements(default_extensions) ; i++) {
if (!default_extensions[i].flag_offset ||
*(base + default_extensions[i].flag_offset)) {
GLuint len = (GLuint)_mesa_strlen(default_extensions[i].name);
_mesa_memcpy(s + extStrLen, default_extensions[i].name, len);
extStrLen += len;
s[extStrLen] = (GLubyte) ' ';
extStrLen++;
}
}
ASSERT(extStrLen > 0);
s[extStrLen - 1] = 0;
return s;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -