fixed VB->IndexPtr==NULL bug (Richard Guenther)

This commit is contained in:
Brian Paul 2000-01-25 16:49:20 +00:00
parent ebd5feab9a
commit 3781b7bfa5

View file

@ -1,4 +1,4 @@
/* $Id: feedback.c,v 1.7 2000/01/17 15:40:43 brianp Exp $ */
/* $Id: feedback.c,v 1.8 2000/01/25 16:49:20 brianp Exp $ */
/*
* Mesa 3-D graphics library
@ -157,13 +157,14 @@ void gl_feedback_vertex( GLcontext *ctx,
static void gl_do_feedback_vertex( GLcontext *ctx, GLuint v, GLuint pv )
static void feedback_vertex( GLcontext *ctx, GLuint v, GLuint pv )
{
GLfloat win[4];
GLfloat color[4];
GLfloat tc[4];
GLuint texUnit = ctx->Texture.CurrentTransformUnit;
struct vertex_buffer *VB = ctx->VB;
const struct vertex_buffer *VB = ctx->VB;
GLuint index;
win[0] = VB->Win.data[v][0];
win[1] = VB->Win.data[v][1];
@ -190,7 +191,12 @@ static void gl_do_feedback_vertex( GLcontext *ctx, GLuint v, GLuint pv )
VB->TexCoordPtr[texUnit]->data[v]);
}
gl_feedback_vertex( ctx, win, color, VB->IndexPtr->data[v], tc );
if (VB->IndexPtr)
index = VB->IndexPtr->data[v];
else
index = 0;
gl_feedback_vertex( ctx, win, color, index, tc );
}
@ -205,9 +211,9 @@ void gl_feedback_triangle( GLcontext *ctx,
FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_POLYGON_TOKEN );
FEEDBACK_TOKEN( ctx, (GLfloat) 3 ); /* three vertices */
gl_do_feedback_vertex( ctx, v0, pv );
gl_do_feedback_vertex( ctx, v1, pv );
gl_do_feedback_vertex( ctx, v2, pv );
feedback_vertex( ctx, v0, pv );
feedback_vertex( ctx, v1, pv );
feedback_vertex( ctx, v2, pv );
}
}
@ -221,8 +227,8 @@ void gl_feedback_line( GLcontext *ctx, GLuint v1, GLuint v2, GLuint pv )
FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) token );
gl_do_feedback_vertex( ctx, v1, pv );
gl_do_feedback_vertex( ctx, v2, pv );
feedback_vertex( ctx, v1, pv );
feedback_vertex( ctx, v2, pv );
ctx->StippleCounter++;
}
@ -230,13 +236,13 @@ void gl_feedback_line( GLcontext *ctx, GLuint v1, GLuint v2, GLuint pv )
void gl_feedback_points( GLcontext *ctx, GLuint first, GLuint last )
{
struct vertex_buffer *VB = ctx->VB;
const struct vertex_buffer *VB = ctx->VB;
GLuint i;
for (i=first;i<=last;i++) {
if (VB->ClipMask[i]==0) {
FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_POINT_TOKEN );
gl_do_feedback_vertex( ctx, i, i );
feedback_vertex( ctx, i, i );
}
}
}