Add GL_POINTS as a primitive, including with CVA DrawElements. Useful
for testing non-triangle primitives on hardware driver fastpaths.
This commit is contained in:
parent
8cbc573eae
commit
c851646050
|
@ -1,4 +1,4 @@
|
|||
/* $Id: isosurf.c,v 1.7 2000/12/24 22:53:54 pesco Exp $ */
|
||||
/* $Id: isosurf.c,v 1.8 2001/01/06 20:38:03 gareth Exp $ */
|
||||
|
||||
/*
|
||||
* Display an isosurface of 3-D wind speed volume.
|
||||
|
@ -53,17 +53,18 @@
|
|||
#define SHADE_FLAT 0x4000
|
||||
#define TRIANGLES 0x8000
|
||||
#define STRIPS 0x10000
|
||||
#define USER_CLIP 0x20000
|
||||
#define NO_USER_CLIP 0x40000
|
||||
#define MATERIALS 0x80000
|
||||
#define NO_MATERIALS 0x100000
|
||||
#define FOG 0x200000
|
||||
#define NO_FOG 0x400000
|
||||
#define QUIT 0x800000
|
||||
#define DISPLAYLIST 0x1000000
|
||||
#define GLINFO 0x2000000
|
||||
#define STIPPLE 0x4000000
|
||||
#define NO_STIPPLE 0x8000000
|
||||
#define POINTS 0x20000
|
||||
#define USER_CLIP 0x40000
|
||||
#define NO_USER_CLIP 0x80000
|
||||
#define MATERIALS 0x100000
|
||||
#define NO_MATERIALS 0x200000
|
||||
#define FOG 0x400000
|
||||
#define NO_FOG 0x800000
|
||||
#define QUIT 0x1000000
|
||||
#define DISPLAYLIST 0x2000000
|
||||
#define GLINFO 0x4000000
|
||||
#define STIPPLE 0x8000000
|
||||
#define NO_STIPPLE 0x10000000
|
||||
|
||||
#define LIGHT_MASK (LIT|UNLIT)
|
||||
#define TEXTURE_MASK (TEXTURE|NO_TEXTURE)
|
||||
|
@ -72,7 +73,7 @@
|
|||
#define RENDER_STYLE_MASK (GLVERTEX|DRAW_ARRAYS|ARRAY_ELT)
|
||||
#define COMPILED_MASK (COMPILED|IMMEDIATE|DISPLAYLIST)
|
||||
#define MATERIAL_MASK (MATERIALS|NO_MATERIALS)
|
||||
#define PRIMITIVE_MASK (TRIANGLES|STRIPS)
|
||||
#define PRIMITIVE_MASK (TRIANGLES|STRIPS|POINTS)
|
||||
#define CLIP_MASK (USER_CLIP|NO_USER_CLIP)
|
||||
#define SHADE_MASK (SHADE_SMOOTH|SHADE_FLAT)
|
||||
#define FOG_MASK (FOG|NO_FOG)
|
||||
|
@ -326,20 +327,8 @@ static void draw_surface( int with_state )
|
|||
switch (with_state & (COMPILED_MASK|RENDER_STYLE_MASK|PRIMITIVE_MASK)) {
|
||||
#ifdef GL_EXT_vertex_array
|
||||
|
||||
case (COMPILED|DRAW_ARRAYS|STRIPS):
|
||||
glDrawElements( GL_TRIANGLE_STRIP, numverts, GL_UNSIGNED_INT, indices );
|
||||
break;
|
||||
|
||||
|
||||
case (COMPILED|ARRAY_ELT|STRIPS):
|
||||
glBegin( GL_TRIANGLE_STRIP );
|
||||
for (i = 0 ; i < numverts ; i++)
|
||||
glArrayElement( indices[i] );
|
||||
glEnd();
|
||||
break;
|
||||
|
||||
case (COMPILED|DRAW_ARRAYS|TRIANGLES):
|
||||
case (IMMEDIATE|DRAW_ARRAYS|TRIANGLES):
|
||||
case (COMPILED|DRAW_ARRAYS|TRIANGLES):
|
||||
if (with_state & MATERIALS) {
|
||||
for (j = i = 0 ; i < num_tri_verts ; i += 600, j++) {
|
||||
GLuint nr = MIN(num_tri_verts-i, 600);
|
||||
|
@ -351,22 +340,6 @@ static void draw_surface( int with_state )
|
|||
glDrawElements( GL_TRIANGLES, num_tri_verts, GL_UNSIGNED_INT,
|
||||
tri_indices );
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
/* Uses the original arrays (including duplicate elements):
|
||||
*/
|
||||
case (IMMEDIATE|DRAW_ARRAYS|STRIPS):
|
||||
glDrawArraysEXT( GL_TRIANGLE_STRIP, 0, numverts );
|
||||
break;
|
||||
|
||||
/* Uses the original arrays (including duplicate elements):
|
||||
*/
|
||||
case (IMMEDIATE|ARRAY_ELT|STRIPS):
|
||||
glBegin( GL_TRIANGLE_STRIP );
|
||||
for (i = 0 ; i < numverts ; i++)
|
||||
glArrayElement( i );
|
||||
glEnd();
|
||||
break;
|
||||
|
||||
case (IMMEDIATE|ARRAY_ELT|TRIANGLES):
|
||||
|
@ -391,6 +364,55 @@ static void draw_surface( int with_state )
|
|||
}
|
||||
break;
|
||||
|
||||
|
||||
/* Uses the original arrays (including duplicate elements):
|
||||
*/
|
||||
case (IMMEDIATE|DRAW_ARRAYS|STRIPS):
|
||||
glDrawArraysEXT( GL_TRIANGLE_STRIP, 0, numverts );
|
||||
break;
|
||||
case (COMPILED|DRAW_ARRAYS|STRIPS):
|
||||
glDrawElements( GL_TRIANGLE_STRIP, numverts, GL_UNSIGNED_INT, indices );
|
||||
break;
|
||||
|
||||
/* Uses the original arrays (including duplicate elements):
|
||||
*/
|
||||
case (IMMEDIATE|ARRAY_ELT|STRIPS):
|
||||
glBegin( GL_TRIANGLE_STRIP );
|
||||
for (i = 0 ; i < numverts ; i++)
|
||||
glArrayElement( i );
|
||||
glEnd();
|
||||
break;
|
||||
|
||||
case (COMPILED|ARRAY_ELT|STRIPS):
|
||||
glBegin( GL_TRIANGLE_STRIP );
|
||||
for (i = 0 ; i < numverts ; i++)
|
||||
glArrayElement( indices[i] );
|
||||
glEnd();
|
||||
break;
|
||||
|
||||
case (DISPLAYLIST|GLVERTEX|STRIPS):
|
||||
if (!surf1)
|
||||
surf1 = BuildList( GL_COMPILE_AND_EXECUTE );
|
||||
else
|
||||
glCallList(surf1);
|
||||
break;
|
||||
|
||||
|
||||
case (IMMEDIATE|DRAW_ARRAYS|POINTS):
|
||||
glDrawArraysEXT( GL_POINTS, 0, numverts );
|
||||
break;
|
||||
case (COMPILED|DRAW_ARRAYS|POINTS):
|
||||
glDrawElements( GL_POINTS, numverts, GL_UNSIGNED_INT, indices );
|
||||
break;
|
||||
case (IMMEDIATE|ARRAY_ELT|POINTS):
|
||||
case (COMPILED|ARRAY_ELT|POINTS):
|
||||
glBegin( GL_POINTS );
|
||||
for (i = 0 ; i < numverts ; i++)
|
||||
glArrayElement( indices[i] );
|
||||
glEnd();
|
||||
break;
|
||||
#endif
|
||||
|
||||
case (IMMEDIATE|GLVERTEX|TRIANGLES):
|
||||
if (with_state & MATERIALS) {
|
||||
for (j = i = 0 ; i < num_tri_verts ; i += 600, j++) {
|
||||
|
@ -415,15 +437,15 @@ static void draw_surface( int with_state )
|
|||
}
|
||||
break;
|
||||
|
||||
case (DISPLAYLIST|GLVERTEX|STRIPS):
|
||||
if (!surf1)
|
||||
surf1 = BuildList( GL_COMPILE_AND_EXECUTE );
|
||||
else
|
||||
glCallList(surf1);
|
||||
case (IMMEDIATE|GLVERTEX|POINTS):
|
||||
glBegin( GL_POINTS );
|
||||
for ( i = 0 ; i < numverts ; i++ ) {
|
||||
glNormal3fv( &data[i][3] );
|
||||
glVertex3fv( &data[i][0] );
|
||||
}
|
||||
glEnd();
|
||||
break;
|
||||
|
||||
#endif
|
||||
|
||||
/* Uses the original arrays (including duplicate elements):
|
||||
*/
|
||||
default:
|
||||
|
@ -924,21 +946,26 @@ int main(int argc, char **argv)
|
|||
glutAddMenuEntry("Point Filtered", POINT_FILTER);
|
||||
glutAddMenuEntry("Linear Filtered", LINEAR_FILTER);
|
||||
glutAddMenuEntry("", 0);
|
||||
glutAddMenuEntry("glVertex (STRIPS)", IMMEDIATE|GLVERTEX|STRIPS);
|
||||
glutAddMenuEntry("glVertex (TRIANGLES)", IMMEDIATE|GLVERTEX|TRIANGLES);
|
||||
glutAddMenuEntry("glVertex (STRIPS)", IMMEDIATE|GLVERTEX|STRIPS);
|
||||
glutAddMenuEntry("glVertex (POINTS)", IMMEDIATE|GLVERTEX|POINTS);
|
||||
glutAddMenuEntry("", 0);
|
||||
glutAddMenuEntry("glVertex display list (STRIPS)",
|
||||
DISPLAYLIST|GLVERTEX|STRIPS);
|
||||
glutAddMenuEntry("", 0);
|
||||
if (allowed & DRAW_ARRAYS) {
|
||||
glutAddMenuEntry("DrawArrays (STRIPS)",
|
||||
IMMEDIATE|DRAW_ARRAYS|STRIPS);
|
||||
glutAddMenuEntry("ArrayElement (STRIPS)",
|
||||
IMMEDIATE|ARRAY_ELT|STRIPS);
|
||||
glutAddMenuEntry("DrawElements (TRIANGLES)",
|
||||
IMMEDIATE|DRAW_ARRAYS|TRIANGLES);
|
||||
glutAddMenuEntry("DrawArrays (STRIPS)",
|
||||
IMMEDIATE|DRAW_ARRAYS|STRIPS);
|
||||
glutAddMenuEntry("DrawArrays (POINTS)",
|
||||
IMMEDIATE|DRAW_ARRAYS|POINTS);
|
||||
glutAddMenuEntry("ArrayElement (TRIANGLES)",
|
||||
IMMEDIATE|ARRAY_ELT|TRIANGLES);
|
||||
glutAddMenuEntry("ArrayElement (STRIPS)",
|
||||
IMMEDIATE|ARRAY_ELT|STRIPS);
|
||||
glutAddMenuEntry("ArrayElement (POINTS)",
|
||||
IMMEDIATE|ARRAY_ELT|POINTS);
|
||||
glutAddMenuEntry("", 0);
|
||||
|
||||
}
|
||||
|
@ -947,10 +974,14 @@ int main(int argc, char **argv)
|
|||
COMPILED|DRAW_ARRAYS|TRIANGLES);
|
||||
glutAddMenuEntry("Compiled DrawElements (STRIPS)",
|
||||
COMPILED|DRAW_ARRAYS|STRIPS);
|
||||
glutAddMenuEntry("Compiled DrawElements (POINTS)",
|
||||
COMPILED|DRAW_ARRAYS|POINTS);
|
||||
glutAddMenuEntry("Compiled ArrayElement (TRIANGLES)",
|
||||
COMPILED|ARRAY_ELT|TRIANGLES);
|
||||
glutAddMenuEntry("Compiled ArrayElement (STRIPS)",
|
||||
COMPILED|ARRAY_ELT|STRIPS);
|
||||
glutAddMenuEntry("Compiled ArrayElement (POINTS)",
|
||||
COMPILED|ARRAY_ELT|POINTS);
|
||||
glutAddMenuEntry("", 0);
|
||||
}
|
||||
glutAddMenuEntry("Quit", QUIT);
|
||||
|
|
Loading…
Reference in New Issue