diff options
Diffstat (limited to 'progs/demos/isosurf.c')
-rw-r--r-- | progs/demos/isosurf.c | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/progs/demos/isosurf.c b/progs/demos/isosurf.c index e280d8f507..2e9dff1726 100644 --- a/progs/demos/isosurf.c +++ b/progs/demos/isosurf.c @@ -514,12 +514,27 @@ static void draw_surface( unsigned int with_state ) break; case (GLVERTEX|STRIPS): - glBegin( GL_TRIANGLE_STRIP ); - for (i=0;i<numverts;i++) { - glNormal3fv( &data[i][3] ); - glVertex3fv( &data[i][0] ); + if (with_state & MATERIALS) { + glBegin( GL_TRIANGLE_STRIP ); + for (i=0;i<numverts;i++) { + if (i % 600 == 0 && i != 0) { + unsigned j = i / 600; + glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, col[j]); + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, col[j]); + } + glNormal3fv( &data[i][3] ); + glVertex3fv( &data[i][0] ); + } + glEnd(); + } + else { + glBegin( GL_TRIANGLE_STRIP ); + for (i=0;i<numverts;i++) { + glNormal3fv( &data[i][3] ); + glVertex3fv( &data[i][0] ); + } + glEnd(); } - glEnd(); break; default: @@ -832,8 +847,8 @@ static void Init(int argc, char *argv[]) glClearColor(0.0, 0.0, 1.0, 0.0); glEnable( GL_DEPTH_TEST ); - glEnable( GL_VERTEX_ARRAY_EXT ); - glEnable( GL_NORMAL_ARRAY_EXT ); + glEnableClientState( GL_VERTEX_ARRAY ); + glEnableClientState( GL_NORMAL_ARRAY ); glMatrixMode(GL_PROJECTION); glLoadIdentity(); |