From 2e61d136c27b9c740190643668f1e3509ce609dc Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sat, 24 Jan 2009 16:39:49 +0000 Subject: progs: Port most of the demos to glew. A couple of test weren't ported due to glew breakage -- it undefines GLAPIENTRY. --- progs/demos/isosurf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'progs/demos/isosurf.c') diff --git a/progs/demos/isosurf.c b/progs/demos/isosurf.c index 10f94b6ace..e2ff6bea0b 100644 --- a/progs/demos/isosurf.c +++ b/progs/demos/isosurf.c @@ -33,7 +33,7 @@ #include #undef CLIP_MASK #endif -#define GL_GLEXT_PROTOTYPES +#include #include "GL/glut.h" #include "readtex.h" @@ -1052,6 +1052,7 @@ int main(int argc, char **argv) glutInitDisplayMode(type); if (glutCreateWindow("Isosurface") <= 0) { + glewInit(); exit(0); } -- cgit v1.2.3 From efdb7799d31b33ce82f9fdedf43ae17bd68f5c84 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sat, 24 Jan 2009 16:47:50 +0000 Subject: progs: Fix isosurf. --- progs/demos/isosurf.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'progs/demos/isosurf.c') diff --git a/progs/demos/isosurf.c b/progs/demos/isosurf.c index e2ff6bea0b..393741cc9d 100644 --- a/progs/demos/isosurf.c +++ b/progs/demos/isosurf.c @@ -1033,7 +1033,6 @@ static GLint Args(int argc, char **argv) int main(int argc, char **argv) { GLenum type; - char *extensions; GLuint arg_mode = Args(argc, argv); @@ -1052,19 +1051,18 @@ int main(int argc, char **argv) glutInitDisplayMode(type); if (glutCreateWindow("Isosurface") <= 0) { - glewInit(); exit(0); } - /* Make sure server supports the vertex array extension */ - extensions = (char *) glGetString( GL_EXTENSIONS ); + glewInit(); - if (!strstr( extensions, "GL_EXT_vertex_array" )) + /* Make sure server supports the vertex array extension */ + if (!GLEW_EXT_vertex_array) { printf("Vertex arrays not supported by this renderer\n"); allowed &= ~(LOCKED|DRAW_ARRAYS|DRAW_ELTS|ARRAY_ELT); } - else if (!strstr( extensions, "GL_EXT_compiled_vertex_array" )) + else if (!GLEW_EXT_compiled_vertex_array) { printf("Compiled vertex arrays not supported by this renderer\n"); allowed &= ~LOCKED; -- cgit v1.2.3 From 54e20828e61685510dc729093f5c6fd1aa7c89fe Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Fri, 13 Feb 2009 17:53:49 +0100 Subject: demos: Add polygon mode point to isosurf --- progs/demos/isosurf.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'progs/demos/isosurf.c') diff --git a/progs/demos/isosurf.c b/progs/demos/isosurf.c index 393741cc9d..e280d8f507 100644 --- a/progs/demos/isosurf.c +++ b/progs/demos/isosurf.c @@ -69,6 +69,7 @@ #define NO_STIPPLE 0x08000000 #define POLYGON_FILL 0x10000000 #define POLYGON_LINE 0x20000000 +#define POLYGON_POINT 0x40000000 #define LIGHT_MASK (LIT|UNLIT|REFLECT) #define FILTER_MASK (POINT_FILTER|LINEAR_FILTER) @@ -81,7 +82,7 @@ #define SHADE_MASK (SHADE_SMOOTH|SHADE_FLAT) #define FOG_MASK (FOG|NO_FOG) #define STIPPLE_MASK (STIPPLE|NO_STIPPLE) -#define POLYGON_MASK (POLYGON_FILL|POLYGON_LINE) +#define POLYGON_MASK (POLYGON_FILL|POLYGON_LINE|POLYGON_POINT) #define MAXVERTS 10000 static GLint maxverts = MAXVERTS; @@ -147,7 +148,7 @@ static void read_surface( char *filename ) static void print_flags( const char *msg, GLuint flags ) { fprintf(stderr, - "%s (0x%x): %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", + "%s (0x%x): %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", msg, flags, (flags & GLVERTEX) ? "glVertex, " : "", (flags & DRAW_ARRAYS) ? "glDrawArrays, " : "", @@ -166,7 +167,8 @@ static void print_flags( const char *msg, GLuint flags ) (flags & MATERIALS) ? "materials, " : "", (flags & FOG) ? "fog, " : "", (flags & STIPPLE) ? "stipple, " : "", - (flags & POLYGON_LINE) ? "polygon mode line, " : ""); + (flags & POLYGON_LINE) ? "polygon mode line, " : "", + (flags & POLYGON_POINT) ? "polygon mode point, " : ""); } @@ -711,9 +713,12 @@ static void ModeMenu(int m) if (m & POLYGON_FILL) { glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); } - else { + else if (m & POLYGON_LINE) { glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); } + else { + glPolygonMode(GL_FRONT_AND_BACK, GL_POINT); + } } #ifdef GL_EXT_vertex_array @@ -1089,6 +1094,7 @@ int main(int argc, char **argv) glutAddMenuEntry("", 0); glutAddMenuEntry("Polygon Mode Fill", POLYGON_FILL); glutAddMenuEntry("Polygon Mode Line", POLYGON_LINE); + glutAddMenuEntry("Polygon Mode Points", POLYGON_POINT); glutAddMenuEntry("", 0); glutAddMenuEntry("Point Filtered", POINT_FILTER); glutAddMenuEntry("Linear Filtered", LINEAR_FILTER); -- cgit v1.2.3 From a9ae89d104161c1052beda7e3dcb21b8b7af5ba3 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Sun, 31 May 2009 19:07:21 -0700 Subject: progs/isosurf: add materials mode for glVertex + TRISTRIP --- progs/demos/isosurf.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'progs/demos/isosurf.c') diff --git a/progs/demos/isosurf.c b/progs/demos/isosurf.c index e280d8f507..6923ca2bba 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 Date: Wed, 8 Jul 2009 13:58:30 -0600 Subject: demos: use glEnable/DisableClientState() for vertex arrays --- progs/demos/isosurf.c | 4 ++-- progs/glsl/multitex.c | 2 +- progs/slang/vstest.c | 24 ++++++++++++------------ progs/tests/bufferobj.c | 8 ++++---- progs/tests/mapbufrange.c | 4 ++-- progs/tests/mapvbo.c | 4 ++-- progs/xdemos/glxswapcontrol.c | 8 ++++---- 7 files changed, 27 insertions(+), 27 deletions(-) (limited to 'progs/demos/isosurf.c') diff --git a/progs/demos/isosurf.c b/progs/demos/isosurf.c index 6923ca2bba..2e9dff1726 100644 --- a/progs/demos/isosurf.c +++ b/progs/demos/isosurf.c @@ -847,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(); diff --git a/progs/glsl/multitex.c b/progs/glsl/multitex.c index cbf173304c..2e3770dc40 100644 --- a/progs/glsl/multitex.c +++ b/progs/glsl/multitex.c @@ -140,7 +140,7 @@ DrawPolygonArray(void) } else { glVertexPointer(2, GL_FLOAT, 0, vertPtr); - glEnable(GL_VERTEX_ARRAY); + glEnableClientState(GL_VERTEX_ARRAY); } glVertexAttribPointer_func(TexCoord0_attr, 2, GL_FLOAT, GL_FALSE, diff --git a/progs/slang/vstest.c b/progs/slang/vstest.c index 5108d15742..472ea9b62e 100644 --- a/progs/slang/vstest.c +++ b/progs/slang/vstest.c @@ -128,29 +128,29 @@ static void va_render () { case C: glColorPointer (4, GL_FLOAT, 0, att->data); - glEnable (GL_COLOR_ARRAY); + glEnableClientState (GL_COLOR_ARRAY); break; case S: glSecondaryColorPointerEXT (4, GL_FLOAT, 0, att->data); - glEnable (GL_SECONDARY_COLOR_ARRAY_EXT); + glEnableClientState (GL_SECONDARY_COLOR_ARRAY_EXT); break; case N: glNormalPointer (GL_FLOAT, 0, att->data); - glEnable (GL_NORMAL_ARRAY); + glEnableClientState (GL_NORMAL_ARRAY); break; case V: glVertexPointer (4, GL_FLOAT, 0, att->data); - glEnable (GL_VERTEX_ARRAY); + glEnableClientState (GL_VERTEX_ARRAY); break; case T: assert (att->index >= 0 && att->index < 8); glClientActiveTextureARB (GL_TEXTURE0_ARB + att->index); glTexCoordPointer (4, GL_FLOAT, 0, att->data); - glEnable (GL_TEXTURE_COORD_ARRAY); + glEnableClientState (GL_TEXTURE_COORD_ARRAY); break; case F: glFogCoordPointerEXT (GL_FLOAT, 0, att->data); - glEnable (GL_FOG_COORDINATE_ARRAY_EXT); + glEnableClientState (GL_FOG_COORDINATE_ARRAY_EXT); break; case A: assert (att->index > 0 && att->index < 16); @@ -169,23 +169,23 @@ static void va_render () switch (att->dispatch) { case C: - glDisable (GL_COLOR_ARRAY); + glDisableClientState (GL_COLOR_ARRAY); break; case S: - glDisable (GL_SECONDARY_COLOR_ARRAY_EXT); + glDisableClientState (GL_SECONDARY_COLOR_ARRAY_EXT); break; case N: - glDisable (GL_NORMAL_ARRAY); + glDisableClientState (GL_NORMAL_ARRAY); break; case V: - glDisable (GL_VERTEX_ARRAY); + glDisableClientState (GL_VERTEX_ARRAY); break; case T: glClientActiveTextureARB (GL_TEXTURE0_ARB + att->index); - glDisable (GL_TEXTURE_COORD_ARRAY); + glDisableClientState (GL_TEXTURE_COORD_ARRAY); break; case F: - glDisable (GL_FOG_COORDINATE_ARRAY_EXT); + glDisableClientState (GL_FOG_COORDINATE_ARRAY_EXT); break; case A: glDisableVertexAttribArrayARB (att->index); diff --git a/progs/tests/bufferobj.c b/progs/tests/bufferobj.c index 220bd1f506..d4ca270016 100644 --- a/progs/tests/bufferobj.c +++ b/progs/tests/bufferobj.c @@ -73,7 +73,7 @@ static void DrawObject( const struct object *obj ) glBindBufferARB(GL_ARRAY_BUFFER_ARB, obj->VertexBufferID); glVertexPointer(3, GL_FLOAT, obj->VertexStride, (void *) obj->VertexOffset); - glEnable(GL_VERTEX_ARRAY); + glEnableClientState(GL_VERTEX_ARRAY); /* test push/pop attrib */ /* XXX this leads to a segfault with NVIDIA's 53.36 driver */ @@ -88,7 +88,7 @@ static void DrawObject( const struct object *obj ) #endif glBindBufferARB(GL_ARRAY_BUFFER_ARB, obj->ColorBufferID); glColorPointer(3, GL_FLOAT, obj->ColorStride, (void *) obj->ColorOffset); - glEnable(GL_COLOR_ARRAY); + glEnableClientState(GL_COLOR_ARRAY); if (obj->NumElements > 0) { /* indexed arrays */ @@ -223,11 +223,11 @@ CreateVertexArrayObject(struct object *obj) glBindBufferARB(GL_ARRAY_BUFFER_ARB, obj->VertexBufferID); glVertexPointer(3, GL_FLOAT, obj->VertexStride, (void *) obj->VertexOffset); - glEnable(GL_VERTEX_ARRAY); + glEnableClientState(GL_VERTEX_ARRAY); glBindBufferARB(GL_ARRAY_BUFFER_ARB, obj->ColorBufferID); glColorPointer(3, GL_FLOAT, obj->ColorStride, (void *) obj->ColorOffset); - glEnable(GL_COLOR_ARRAY); + glEnableClientState(GL_COLOR_ARRAY); glBindVertexArray(0); } diff --git a/progs/tests/mapbufrange.c b/progs/tests/mapbufrange.c index 0021bb2607..76e02dd406 100644 --- a/progs/tests/mapbufrange.c +++ b/progs/tests/mapbufrange.c @@ -98,10 +98,10 @@ Draw(void) { glBindBufferARB(GL_ARRAY_BUFFER_ARB, BufferID); glVertexPointer(3, GL_FLOAT, 24, 0); - glEnable(GL_VERTEX_ARRAY); + glEnableClientState(GL_VERTEX_ARRAY); glColorPointer(3, GL_FLOAT, 24, (void*) 12); - glEnable(GL_COLOR_ARRAY); + glEnableClientState(GL_COLOR_ARRAY); glDrawArrays(GL_QUADS, 0, NumRects * 4); diff --git a/progs/tests/mapvbo.c b/progs/tests/mapvbo.c index c392e76835..52a22a5e79 100644 --- a/progs/tests/mapvbo.c +++ b/progs/tests/mapvbo.c @@ -54,10 +54,10 @@ Draw(void) glBindBufferARB(GL_ARRAY_BUFFER_ARB, BufferID); glVertexPointer(3, GL_FLOAT, 24, 0); - glEnable(GL_VERTEX_ARRAY); + glEnableClientState(GL_VERTEX_ARRAY); glColorPointer(3, GL_FLOAT, 24, (void*) 12); - glEnable(GL_COLOR_ARRAY); + glEnableClientState(GL_COLOR_ARRAY); glDrawArrays(GL_TRIANGLE_FAN, 0, 4); diff --git a/progs/xdemos/glxswapcontrol.c b/progs/xdemos/glxswapcontrol.c index 5a5d084f90..df9f7ad784 100644 --- a/progs/xdemos/glxswapcontrol.c +++ b/progs/xdemos/glxswapcontrol.c @@ -303,13 +303,13 @@ draw(void) glDisable(GL_LIGHTING); glShadeModel(GL_SMOOTH); - glEnable( GL_VERTEX_ARRAY ); - glEnable( GL_COLOR_ARRAY ); + glEnableClientState( GL_VERTEX_ARRAY ); + glEnableClientState( GL_COLOR_ARRAY ); glVertexPointer( 3, GL_FLOAT, 0, vert ); glColorPointer( 3, GL_FLOAT, 0, col ); glDrawArrays( GL_POLYGON, 0, 4 ); - glDisable( GL_COLOR_ARRAY ); - glDisable( GL_VERTEX_ARRAY ); + glDisableClientState( GL_COLOR_ARRAY ); + glDisableClientState( GL_VERTEX_ARRAY ); glMatrixMode(GL_PROJECTION); glLoadIdentity(); -- cgit v1.2.3