From fdb07636f2e6324c5250cd5ee97778b7f5933bea Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 22 Feb 2005 22:36:31 +0000 Subject: Added __glExtensionBiIsEnabled and __GLXcontext::gl_extension_bits. This enables libGL to query which extension are exported to applications. Refactored array-query functionality (from glGet*v) in src/glx/x11/single2.c. Massive re-write of indirect vertex array support. The most noticable effect is that glDrawElements now generates DrawArrays protocol. The side-effects (and the main reasons for the re-work) are that it is much easier to add support for new arrays (e.g., GL_VERTEX_ATTRIB_ARRAY, GL_WEIGHT_ARRAY_ARB, etc.) and it is much easier to add support for the new DrawArrays protocol (required to support ARB_vertex_buffer_object). These changes were primarilly tested with progs/demos/isosurf. --- src/glx/x11/clientattrib.c | 81 +++++++++++----------------------------------- 1 file changed, 18 insertions(+), 63 deletions(-) (limited to 'src/glx/x11/clientattrib.c') diff --git a/src/glx/x11/clientattrib.c b/src/glx/x11/clientattrib.c index 298978fc0b..9cfb3c9c39 100644 --- a/src/glx/x11/clientattrib.c +++ b/src/glx/x11/clientattrib.c @@ -36,77 +36,34 @@ #include #include "glxclient.h" +#include "indirect_vertex_array.h" /*****************************************************************************/ -void __indirect_glEnableClientState(GLenum array) +static void +do_enable_disable(GLenum array, GLboolean val ) { __GLXcontext *gc = __glXGetCurrentContext(); __GLXattribute * state = (__GLXattribute *)(gc->client_state_private); + unsigned index = 0; + + if ( array == GL_TEXTURE_COORD_ARRAY ) { + index = __glXGetActiveTextureUnit( state ); + } - switch (array) { - case GL_COLOR_ARRAY: - ENABLE_ARRAY(state, color); - break; - case GL_EDGE_FLAG_ARRAY: - ENABLE_ARRAY(state, edgeFlag); - break; - case GL_INDEX_ARRAY: - ENABLE_ARRAY(state, index); - break; - case GL_NORMAL_ARRAY: - ENABLE_ARRAY(state, normal); - break; - case GL_TEXTURE_COORD_ARRAY: - ENABLE_TEXARRAY(state, state->vertArray.activeTexture); - break; - case GL_VERTEX_ARRAY: - ENABLE_ARRAY(state, vertex); - break; - case GL_SECONDARY_COLOR_ARRAY: - ENABLE_ARRAY(state, secondaryColor); - break; - case GL_FOG_COORD_ARRAY: - ENABLE_ARRAY(state, fogCoord); - break; - default: - __glXSetError(gc, GL_INVALID_ENUM); + if ( ! __glXSetArrayEnable( state, array, index, val ) ) { + __glXSetError(gc, GL_INVALID_ENUM); } } -void __indirect_glDisableClientState(GLenum array) +void __indirect_glEnableClientState(GLenum array) { - __GLXcontext *gc = __glXGetCurrentContext(); - __GLXattribute * state = (__GLXattribute *)(gc->client_state_private); + do_enable_disable( array, GL_TRUE ); +} - switch (array) { - case GL_COLOR_ARRAY: - DISABLE_ARRAY(state, color); - break; - case GL_EDGE_FLAG_ARRAY: - DISABLE_ARRAY(state, edgeFlag); - break; - case GL_INDEX_ARRAY: - DISABLE_ARRAY(state, index); - break; - case GL_NORMAL_ARRAY: - DISABLE_ARRAY(state, normal); - break; - case GL_TEXTURE_COORD_ARRAY: - DISABLE_TEXARRAY(state, state->vertArray.activeTexture); - break; - case GL_VERTEX_ARRAY: - DISABLE_ARRAY(state, vertex); - break; - case GL_SECONDARY_COLOR_ARRAY: - DISABLE_ARRAY(state, secondaryColor); - break; - case GL_FOG_COORD_ARRAY: - DISABLE_ARRAY(state, fogCoord); - break; - default: - __glXSetError(gc, GL_INVALID_ENUM); - } +void __indirect_glDisableClientState(GLenum array) +{ + do_enable_disable( array, GL_FALSE ); } /************************************************************************/ @@ -129,7 +86,7 @@ void __indirect_glPushClientAttrib(GLuint mask) sp->storeUnpack = state->storeUnpack; } if (mask & GL_CLIENT_VERTEX_ARRAY_BIT) { - sp->vertArray = state->vertArray; + __glXPushArrayState( state ); } } else { __glXSetError(gc, GL_STACK_OVERFLOW); @@ -156,7 +113,7 @@ void __indirect_glPopClientAttrib(void) state->storeUnpack = sp->storeUnpack; } if (mask & GL_CLIENT_VERTEX_ARRAY_BIT) { - state->vertArray = sp->vertArray; + __glXPopArrayState( state ); } sp->mask = 0; @@ -181,5 +138,3 @@ void __glFreeAttributeState(__GLXcontext *gc) } } } - - -- cgit v1.2.3