From 6c14bdc72fd033356cc94633622f1360591d565d Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 18 Dec 2008 09:48:20 -0700 Subject: demos: all glutDestroyWindow() upon exit to test query object clean-up --- progs/demos/arbocclude.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'progs/demos/arbocclude.c') diff --git a/progs/demos/arbocclude.c b/progs/demos/arbocclude.c index ddbb1f1b759..6bf4fd218b9 100644 --- a/progs/demos/arbocclude.c +++ b/progs/demos/arbocclude.c @@ -37,7 +37,7 @@ static GLboolean Anim = GL_TRUE; static GLfloat Xpos = 0; static GLuint OccQuery; - +static GLint Win = 0; static void @@ -204,6 +204,7 @@ static void Key( unsigned char key, int x, int y ) (void) y; switch (key) { case 27: + glutDestroyWindow(Win); exit(0); break; case ' ': @@ -271,7 +272,7 @@ int main( int argc, char *argv[] ) glutInitWindowPosition( 0, 0 ); glutInitWindowSize( 400, 400 ); glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ); - glutCreateWindow(argv[0]); + Win = glutCreateWindow(argv[0]); glutReshapeFunc( Reshape ); glutKeyboardFunc( Key ); glutSpecialFunc( SpecialKey ); -- cgit v1.2.3 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/Makefile | 8 ++++---- progs/demos/arbocclude.c | 3 ++- progs/demos/copypix.c | 4 ++-- progs/demos/engine.c | 4 ++-- progs/demos/fbo_firecube.c | 3 ++- progs/demos/fplight.c | 3 ++- progs/demos/isosurf.c | 3 ++- progs/demos/paltex.c | 3 ++- progs/demos/pointblast.c | 3 ++- progs/demos/shadowtex.c | 3 ++- progs/demos/spriteblast.c | 3 ++- progs/demos/streaming_rect.c | 4 ++-- 12 files changed, 26 insertions(+), 18 deletions(-) (limited to 'progs/demos/arbocclude.c') diff --git a/progs/demos/Makefile b/progs/demos/Makefile index 467dbc5cdf9..e636cbd9ad9 100644 --- a/progs/demos/Makefile +++ b/progs/demos/Makefile @@ -5,16 +5,16 @@ include $(TOP)/configs/current INCDIR = $(TOP)/include -OSMESA_LIBS = -L$(TOP)/$(LIB_DIR) -lglut -lOSMesa -lGLU -lGL $(APP_LIB_DEPS) +OSMESA_LIBS = -L$(TOP)/$(LIB_DIR) -lglut -lglew -lOSMesa -lGLU -lGL $(APP_LIB_DEPS) -OSMESA16_LIBS = -L$(TOP)/$(LIB_DIR) -lglut -lOSMesa16 -lGLU -lGL $(APP_LIB_DEPS) +OSMESA16_LIBS = -L$(TOP)/$(LIB_DIR) -lglut -lglew -lOSMesa16 -lGLU -lGL $(APP_LIB_DEPS) -OSMESA32_LIBS = -L$(TOP)/$(LIB_DIR) -lglut -lOSMesa32 -lGLU -lGL $(APP_LIB_DEPS) +OSMESA32_LIBS = -L$(TOP)/$(LIB_DIR) -lglut -lglew -lOSMesa32 -lGLU -lGL $(APP_LIB_DEPS) LIB_DEP = $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) $(TOP)/$(LIB_DIR)/$(GLU_LIB_NAME) \ $(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME) -LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) \ +LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLEW_LIB) -l$(GLU_LIB) -l$(GL_LIB) \ $(APP_LIB_DEPS) PROGS = \ diff --git a/progs/demos/arbocclude.c b/progs/demos/arbocclude.c index 6bf4fd218b9..9188ad5a565 100644 --- a/progs/demos/arbocclude.c +++ b/progs/demos/arbocclude.c @@ -29,7 +29,7 @@ #include #include #include -#define GL_GLEXT_PROTOTYPES +#include #include #define TEST_DISPLAY_LISTS 0 @@ -273,6 +273,7 @@ int main( int argc, char *argv[] ) glutInitWindowSize( 400, 400 ); glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ); Win = glutCreateWindow(argv[0]); + glewInit(); glutReshapeFunc( Reshape ); glutKeyboardFunc( Key ); glutSpecialFunc( SpecialKey ); diff --git a/progs/demos/copypix.c b/progs/demos/copypix.c index 15001e851be..51435acfa0f 100644 --- a/progs/demos/copypix.c +++ b/progs/demos/copypix.c @@ -6,11 +6,10 @@ */ -#define GL_GLEXT_PROTOTYPES - #include #include #include +#include #include #include "readtex.h" @@ -234,6 +233,7 @@ int main( int argc, char *argv[] ) glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE); glutCreateWindow(argv[0]); + glewInit(); Init(ciMode, filename); Usage(); diff --git a/progs/demos/engine.c b/progs/demos/engine.c index 6040a2f1030..5b9b5baa7b3 100644 --- a/progs/demos/engine.c +++ b/progs/demos/engine.c @@ -5,12 +5,11 @@ * June 2006 */ -#define GL_GLEXT_PROTOTYPES - #include #include #include #include +#include #include #include "readtex.h" #include "trackball.h" @@ -1288,6 +1287,7 @@ main(int argc, char *argv[]) glutInitWindowSize(WinWidth, WinHeight); glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); glutCreateWindow("OpenGL Engine Demo"); + glewInit(); glutReshapeFunc(Reshape); glutMouseFunc(Mouse); glutMotionFunc(Motion); diff --git a/progs/demos/fbo_firecube.c b/progs/demos/fbo_firecube.c index f5ee82a2f11..4e42924a09e 100644 --- a/progs/demos/fbo_firecube.c +++ b/progs/demos/fbo_firecube.c @@ -29,11 +29,11 @@ * */ -#define GL_GLEXT_PROTOTYPES #include #include #include #include +#include #include #include "readtex.h" @@ -1037,6 +1037,7 @@ main(int argc, char *argv[]) glutInitWindowSize(WinWidth, WinHeight); Win = glutCreateWindow("fbo_firecube"); + glewInit(); init(argc, argv); glutDisplayFunc(draw); diff --git a/progs/demos/fplight.c b/progs/demos/fplight.c index fb510cccc8a..c297354103f 100644 --- a/progs/demos/fplight.c +++ b/progs/demos/fplight.c @@ -10,7 +10,7 @@ #include #include #include -#define GL_GLEXT_PROTOTYPES +#include #include @@ -273,6 +273,7 @@ int main( int argc, char *argv[] ) glutInitWindowSize( 200, 200 ); glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ); Win = glutCreateWindow(argv[0]); + glewInit(); glutReshapeFunc( Reshape ); glutKeyboardFunc( Key ); glutSpecialFunc( SpecialKey ); diff --git a/progs/demos/isosurf.c b/progs/demos/isosurf.c index 10f94b6ace2..e2ff6bea0b3 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); } diff --git a/progs/demos/paltex.c b/progs/demos/paltex.c index aa9c0da36b7..d0cbcfb5e9a 100644 --- a/progs/demos/paltex.c +++ b/progs/demos/paltex.c @@ -11,7 +11,7 @@ #ifdef _WIN32 #include #endif -#define GL_GLEXT_PROTOTYPES +#include #include @@ -255,6 +255,7 @@ int main( int argc, char *argv[] ) glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE ); glutCreateWindow(argv[0]); + glewInit(); Init(); (void) Init2; /* silence warning */ diff --git a/progs/demos/pointblast.c b/progs/demos/pointblast.c index dbbe2f35a28..2a91b76ad32 100644 --- a/progs/demos/pointblast.c +++ b/progs/demos/pointblast.c @@ -18,7 +18,7 @@ #ifdef _WIN32 #include #endif -#define GL_GLEXT_PROTOTYPES +#include #include /* Some files do not define M_PI... */ @@ -444,6 +444,7 @@ main(int argc, char **argv) } glutCreateWindow("point burst"); + glewInit(); glutDisplayFunc(redraw); glutMouseFunc(mouse); glutMotionFunc(mouseMotion); diff --git a/progs/demos/shadowtex.c b/progs/demos/shadowtex.c index 4787f0f29d2..f10a01ec265 100644 --- a/progs/demos/shadowtex.c +++ b/progs/demos/shadowtex.c @@ -31,12 +31,12 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#define GL_GLEXT_PROTOTYPES #include #include #include #include #include +#include #include #include "showbuffer.h" @@ -1025,6 +1025,7 @@ main(int argc, char *argv[]) glutInitWindowSize(WindowWidth, WindowHeight); glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH | GLUT_STENCIL); glutCreateWindow(argv[0]); + glewInit(); glutReshapeFunc(Reshape); glutKeyboardFunc(Key); glutSpecialFunc(SpecialKey); diff --git a/progs/demos/spriteblast.c b/progs/demos/spriteblast.c index 5ad8e4d9a94..f6630c25d07 100644 --- a/progs/demos/spriteblast.c +++ b/progs/demos/spriteblast.c @@ -21,7 +21,7 @@ #ifdef _WIN32 #include #endif -#define GL_GLEXT_PROTOTYPES +#include #include /* Some files do not define M_PI... */ @@ -509,6 +509,7 @@ main(int argc, char **argv) glutInitWindowPosition(0, 0); glutInitWindowSize(600,300); glutCreateWindow("sprite blast"); + glewInit(); glutReshapeFunc(reshape); glutDisplayFunc(redraw); glutMouseFunc(mouse); diff --git a/progs/demos/streaming_rect.c b/progs/demos/streaming_rect.c index 4c1d8535fd7..4d4656e722b 100644 --- a/progs/demos/streaming_rect.c +++ b/progs/demos/streaming_rect.c @@ -6,12 +6,11 @@ * */ -#define GL_GLEXT_PROTOTYPES - #include #include #include #include +#include #include #include "readtex.h" @@ -303,6 +302,7 @@ int main( int argc, char *argv[] ) glutInitWindowPosition( 0, 0 ); glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE ); glutCreateWindow(argv[0] ); + glewInit(); Init( argc, argv ); -- cgit v1.2.3