/**
 * Get the selected attribute from the vertex array state vector.
 * 
 * \returns
 * On success \c GL_TRUE is returned.  Otherwise, \c GL_FALSE is returned.
 */
static GLboolean
get_attrib_array_data( __GLXattribute * state, GLuint index, GLenum cap,
		       GLintptr * data )
{
    GLboolean retval = GL_FALSE;
    const GLenum attrib = GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB;

    switch( cap ) {
    case GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB:
	retval = __glXGetArrayEnable( state, attrib, index, data );
	break;

    case GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB:
	retval = __glXGetArraySize( state, attrib, index, data );
	break;

    case GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB:
	retval = __glXGetArrayStride( state, attrib, index, data );
	break;

    case GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB:
	retval = __glXGetArrayType( state, attrib, index, data );
	break;

    case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB:
	retval = __glXGetArrayNormalized( state, attrib, index, data );
	break;
    }

    
    return retval;
}
Exemple #2
0
/**
 * Get the selected attribute from the client state.
 *
 * \returns
 * On success \c GL_TRUE is returned.  Otherwise, \c GL_FALSE is returned.
 */
static GLboolean
get_client_data(struct glx_context * gc, GLenum cap, GLintptr * data)
{
   GLboolean retval = GL_TRUE;
   __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
   const GLint tex_unit = __glXGetActiveTextureUnit(state);


   switch (cap) {
   case GL_VERTEX_ARRAY:
   case GL_NORMAL_ARRAY:
   case GL_COLOR_ARRAY:
   case GL_INDEX_ARRAY:
   case GL_EDGE_FLAG_ARRAY:
   case GL_SECONDARY_COLOR_ARRAY:
   case GL_FOG_COORD_ARRAY:
      retval = __glXGetArrayEnable(state, cap, 0, data);
      break;

   case GL_VERTEX_ARRAY_SIZE:
      retval = __glXGetArraySize(state, GL_VERTEX_ARRAY, 0, data);
      break;
   case GL_COLOR_ARRAY_SIZE:
      retval = __glXGetArraySize(state, GL_COLOR_ARRAY, 0, data);
      break;
   case GL_SECONDARY_COLOR_ARRAY_SIZE:
      retval = __glXGetArraySize(state, GL_SECONDARY_COLOR_ARRAY, 0, data);
      break;

   case GL_VERTEX_ARRAY_TYPE:
      retval = __glXGetArrayType(state, GL_VERTEX_ARRAY, 0, data);
      break;
   case GL_NORMAL_ARRAY_TYPE:
      retval = __glXGetArrayType(state, GL_NORMAL_ARRAY, 0, data);
      break;
   case GL_INDEX_ARRAY_TYPE:
      retval = __glXGetArrayType(state, GL_INDEX_ARRAY, 0, data);
      break;
   case GL_COLOR_ARRAY_TYPE:
      retval = __glXGetArrayType(state, GL_COLOR_ARRAY, 0, data);
      break;
   case GL_SECONDARY_COLOR_ARRAY_TYPE:
      retval = __glXGetArrayType(state, GL_SECONDARY_COLOR_ARRAY, 0, data);
      break;
   case GL_FOG_COORD_ARRAY_TYPE:
      retval = __glXGetArrayType(state, GL_FOG_COORD_ARRAY, 0, data);
      break;

   case GL_VERTEX_ARRAY_STRIDE:
      retval = __glXGetArrayStride(state, GL_VERTEX_ARRAY, 0, data);
      break;
   case GL_NORMAL_ARRAY_STRIDE:
      retval = __glXGetArrayStride(state, GL_NORMAL_ARRAY, 0, data);
      break;
   case GL_INDEX_ARRAY_STRIDE:
      retval = __glXGetArrayStride(state, GL_INDEX_ARRAY, 0, data);
      break;
   case GL_EDGE_FLAG_ARRAY_STRIDE:
      retval = __glXGetArrayStride(state, GL_EDGE_FLAG_ARRAY, 0, data);
      break;
   case GL_COLOR_ARRAY_STRIDE:
      retval = __glXGetArrayStride(state, GL_COLOR_ARRAY, 0, data);
      break;
   case GL_SECONDARY_COLOR_ARRAY_STRIDE:
      retval = __glXGetArrayStride(state, GL_SECONDARY_COLOR_ARRAY, 0, data);
      break;
   case GL_FOG_COORD_ARRAY_STRIDE:
      retval = __glXGetArrayStride(state, GL_FOG_COORD_ARRAY, 0, data);
      break;

   case GL_TEXTURE_COORD_ARRAY:
      retval =
         __glXGetArrayEnable(state, GL_TEXTURE_COORD_ARRAY, tex_unit, data);
      break;
   case GL_TEXTURE_COORD_ARRAY_SIZE:
      retval =
         __glXGetArraySize(state, GL_TEXTURE_COORD_ARRAY, tex_unit, data);
      break;
   case GL_TEXTURE_COORD_ARRAY_TYPE:
      retval =
         __glXGetArrayType(state, GL_TEXTURE_COORD_ARRAY, tex_unit, data);
      break;
   case GL_TEXTURE_COORD_ARRAY_STRIDE:
      retval =
         __glXGetArrayStride(state, GL_TEXTURE_COORD_ARRAY, tex_unit, data);
      break;

   case GL_MAX_ELEMENTS_VERTICES:
   case GL_MAX_ELEMENTS_INDICES:
      retval = GL_TRUE;
      *data = ~0UL;
      break;


   case GL_PACK_ROW_LENGTH:
      *data = (GLintptr) state->storePack.rowLength;
      break;
   case GL_PACK_IMAGE_HEIGHT:
      *data = (GLintptr) state->storePack.imageHeight;
      break;
   case GL_PACK_SKIP_ROWS:
      *data = (GLintptr) state->storePack.skipRows;
      break;
   case GL_PACK_SKIP_PIXELS:
      *data = (GLintptr) state->storePack.skipPixels;
      break;
   case GL_PACK_SKIP_IMAGES:
      *data = (GLintptr) state->storePack.skipImages;
      break;
   case GL_PACK_ALIGNMENT:
      *data = (GLintptr) state->storePack.alignment;
      break;
   case GL_PACK_SWAP_BYTES:
      *data = (GLintptr) state->storePack.swapEndian;
      break;
   case GL_PACK_LSB_FIRST:
      *data = (GLintptr) state->storePack.lsbFirst;
      break;
   case GL_UNPACK_ROW_LENGTH:
      *data = (GLintptr) state->storeUnpack.rowLength;
      break;
   case GL_UNPACK_IMAGE_HEIGHT:
      *data = (GLintptr) state->storeUnpack.imageHeight;
      break;
   case GL_UNPACK_SKIP_ROWS:
      *data = (GLintptr) state->storeUnpack.skipRows;
      break;
   case GL_UNPACK_SKIP_PIXELS:
      *data = (GLintptr) state->storeUnpack.skipPixels;
      break;
   case GL_UNPACK_SKIP_IMAGES:
      *data = (GLintptr) state->storeUnpack.skipImages;
      break;
   case GL_UNPACK_ALIGNMENT:
      *data = (GLintptr) state->storeUnpack.alignment;
      break;
   case GL_UNPACK_SWAP_BYTES:
      *data = (GLintptr) state->storeUnpack.swapEndian;
      break;
   case GL_UNPACK_LSB_FIRST:
      *data = (GLintptr) state->storeUnpack.lsbFirst;
      break;
   case GL_CLIENT_ATTRIB_STACK_DEPTH:
      *data = (GLintptr) (gc->attributes.stackPointer - gc->attributes.stack);
      break;
   case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH:
      *data = (GLintptr) __GL_CLIENT_ATTRIB_STACK_DEPTH;
      break;
   case GL_CLIENT_ACTIVE_TEXTURE:
      *data = (GLintptr) (tex_unit + GL_TEXTURE0);
      break;

   default:
      retval = GL_FALSE;
      break;
   }


   return retval;
}