/*
* Mesa 3-D graphics library
- * Version: 5.1
+ * Version: 6.1
*
- * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
#include "glheader.h"
#include "imports.h"
+#include "bufferobj.h"
#include "context.h"
#include "enable.h"
#include "enums.h"
#include "texstate.h"
#include "mtypes.h"
#include "varray.h"
-
+#include "dispatch.h"
#ifndef GL_BOOLEAN
#define GL_BOOLEAN 0x9999
array->Ptr = (const GLubyte *) ptr;
#if FEATURE_ARB_vertex_buffer_object
array->BufferObj->RefCount--;
- /* XXX free buffer object if RefCount == 0 ? */
+ if (array->BufferObj->RefCount <= 0) {
+ ASSERT(array->BufferObj->Name);
+ _mesa_remove_buffer_object( ctx, array->BufferObj );
+ (*ctx->Driver.DeleteBuffer)( ctx, array->BufferObj );
+ }
array->BufferObj = ctx->Array.ArrayBufferObj;
array->BufferObj->RefCount++;
/* Compute the index of the last array element that's inside the buffer.
const GLint toffset = 0; /* always zero */
GLint defstride; /* default stride */
GLint c, f;
- GLint coordUnitSave;
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
_mesa_DisableClientState( GL_INDEX_ARRAY );
/* Texcoords */
- coordUnitSave = ctx->Array.ActiveTexture;
if (tflag) {
- GLuint i;
- /* enable unit 0 texcoord array */
- _mesa_ClientActiveTextureARB( GL_TEXTURE0_ARB );
_mesa_EnableClientState( GL_TEXTURE_COORD_ARRAY );
_mesa_TexCoordPointer( tcomps, GL_FLOAT, stride,
- (GLubyte *) pointer + i * toffset );
- /* disable all other texcoord arrays */
- for (i = 1; i < ctx->Const.MaxTextureCoordUnits; i++) {
- _mesa_ClientActiveTextureARB( (GLenum) (GL_TEXTURE0_ARB + i) );
- _mesa_DisableClientState( GL_TEXTURE_COORD_ARRAY );
- }
+ (GLubyte *) pointer + toffset );
}
else {
- /* disable all texcoord arrays */
- GLuint i;
- for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) {
- _mesa_ClientActiveTextureARB( (GLenum) (GL_TEXTURE0_ARB + i) );
- _mesa_DisableClientState( GL_TEXTURE_COORD_ARRAY );
- }
+ _mesa_DisableClientState( GL_TEXTURE_COORD_ARRAY );
}
- /* Restore texture coordinate unit index */
- _mesa_ClientActiveTextureARB( (GLenum) (GL_TEXTURE0_ARB + coordUnitSave) );
-
/* Color */
if (cflag) {
for (i = 0; i < primcount; i++) {
if (count[i] > 0) {
- (ctx->Exec->DrawArrays)(mode, first[i], count[i]);
+ CALL_DrawArrays(ctx->Exec, (mode, first[i], count[i]));
}
}
}
for (i = 0; i < primcount; i++) {
if (count[i] > 0) {
- (ctx->Exec->DrawElements)(mode, count[i], type, indices[i]);
+ CALL_DrawElements(ctx->Exec, (mode, count[i], type, indices[i]));
}
}
}
for ( i = 0 ; i < primcount ; i++ ) {
if ( count[i] > 0 ) {
GLenum m = *((GLenum *) ((GLubyte *) mode + i * modestride));
- (ctx->Exec->DrawArrays)( m, first[i], count[i] );
+ CALL_DrawArrays(ctx->Exec, ( m, first[i], count[i] ));
}
}
}
for ( i = 0 ; i < primcount ; i++ ) {
if ( count[i] > 0 ) {
GLenum m = *((GLenum *) ((GLubyte *) mode + i * modestride));
- (ctx->Exec->DrawElements)( m, count[i], type, indices[i] );
+ CALL_DrawElements(ctx->Exec, ( m, count[i], type, indices[i] ));
}
}
}