diff options
author | José Fonseca <[email protected]> | 2010-01-08 15:42:57 +0000 |
---|---|---|
committer | José Fonseca <[email protected]> | 2010-01-08 15:42:57 +0000 |
commit | 080c40ab32b2abd6d8381b4a0cc143d36a1652b2 (patch) | |
tree | e173767ebc5a82d81b9fc086449d915e29348976 /progs/demos | |
parent | 9cdf6f025b2ed55cfb13dd09f870f01d0c7947d3 (diff) | |
parent | a1de400e8de06a80ab140bb0fa950e990607572d (diff) |
Merge remote branch 'origin/master' into lp-binning
Conflicts:
src/gallium/auxiliary/util/u_surface.c
src/gallium/drivers/llvmpipe/Makefile
src/gallium/drivers/llvmpipe/SConscript
src/gallium/drivers/llvmpipe/lp_bld_arit.c
src/gallium/drivers/llvmpipe/lp_bld_flow.c
src/gallium/drivers/llvmpipe/lp_bld_interp.c
src/gallium/drivers/llvmpipe/lp_clear.c
src/gallium/drivers/llvmpipe/lp_context.c
src/gallium/drivers/llvmpipe/lp_context.h
src/gallium/drivers/llvmpipe/lp_draw_arrays.c
src/gallium/drivers/llvmpipe/lp_jit.c
src/gallium/drivers/llvmpipe/lp_jit.h
src/gallium/drivers/llvmpipe/lp_prim_vbuf.c
src/gallium/drivers/llvmpipe/lp_setup.c
src/gallium/drivers/llvmpipe/lp_setup_point.c
src/gallium/drivers/llvmpipe/lp_state.h
src/gallium/drivers/llvmpipe/lp_state_blend.c
src/gallium/drivers/llvmpipe/lp_state_derived.c
src/gallium/drivers/llvmpipe/lp_state_fs.c
src/gallium/drivers/llvmpipe/lp_state_sampler.c
src/gallium/drivers/llvmpipe/lp_state_surface.c
src/gallium/drivers/llvmpipe/lp_tex_cache.c
src/gallium/drivers/llvmpipe/lp_tex_cache.h
src/gallium/drivers/llvmpipe/lp_tex_sample.h
src/gallium/drivers/llvmpipe/lp_tile_cache.c
Diffstat (limited to 'progs/demos')
46 files changed, 193 insertions, 202 deletions
diff --git a/progs/demos/SConscript b/progs/demos/SConscript index f851870bcf3..742dd66f36f 100644 --- a/progs/demos/SConscript +++ b/progs/demos/SConscript @@ -1,84 +1,66 @@ Import('*') -if not env['GLUT']: - Return() - -env = env.Clone() - -env.Prepend(CPPPATH = [ - '../util', -]) - -env.Prepend(LIBS = [ - util, - '$GLUT_LIB' -]) - -if env['platform'] == 'windows': - env.Append(CPPDEFINES = ['NOMINMAX']) - env.Prepend(LIBS = ['winmm']) - progs = [ - 'arbfplight', - 'arbfslight', - 'arbocclude', - 'bounce', - 'clearspd', - 'copypix', - 'cubemap', - 'drawpix', - 'engine', - 'fbo_firecube', - 'fire', - 'fogcoord', - 'fplight', - 'fslight', - 'gamma', - 'gearbox', - 'gears', - 'geartrain', - 'glinfo', - 'gloss', - 'gltestperf', - 'ipers', - 'isosurf', - 'lodbias', - 'morph3d', - 'multiarb', - 'paltex', - 'pointblast', - 'ray', - 'readpix', - 'reflect', - 'renormal', - 'shadowtex', - 'singlebuffer', - 'spectex', - 'spriteblast', - 'stex3d', - 'teapot', - 'terrain', - 'tessdemo', - 'texcyl', - 'texenv', - 'textures', - 'trispd', - 'tunnel', - 'tunnel2', - 'vao_demo', - 'winpos', - 'dinoshade', - 'fbotexture', - 'projtex', + 'arbfplight', + 'arbfslight', + 'arbocclude', + 'bounce', + 'clearspd', + 'copypix', + 'cubemap', + 'drawpix', + 'engine', + 'fbo_firecube', + 'fire', + 'fogcoord', + 'fplight', + 'fslight', + 'gamma', + 'gearbox', + 'gears', + 'geartrain', + 'glinfo', + 'gloss', + 'gltestperf', + 'ipers', + 'isosurf', + 'lodbias', + 'morph3d', + 'multiarb', + 'paltex', + 'pointblast', + 'ray', + 'readpix', + 'reflect', + 'renormal', + 'shadowtex', + 'singlebuffer', + 'spectex', + 'spriteblast', + 'stex3d', + 'teapot', + 'terrain', + 'tessdemo', + 'texcyl', + 'texenv', + 'textures', + 'trispd', + 'tunnel', + 'tunnel2', + 'vao_demo', + 'winpos', + 'dinoshade', + 'fbotexture', + 'projtex', ] for prog in progs: - env.Program( + progs_env.Program( target = prog, source = prog + '.c', ) -env.Program( +progs_env.Program( target = 'rain', source = [ 'rain.cxx', diff --git a/progs/demos/arbfplight.c b/progs/demos/arbfplight.c index 7b7a12bf88d..861b3b72522 100644 --- a/progs/demos/arbfplight.c +++ b/progs/demos/arbfplight.c @@ -388,9 +388,8 @@ static void Init( void ) int main( int argc, char *argv[] ) { - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); glutInitWindowSize( 200, 200 ); + glutInit( &argc, argv ); glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ); Win = glutCreateWindow(argv[0]); glutReshapeFunc( Reshape ); diff --git a/progs/demos/arbfslight.c b/progs/demos/arbfslight.c index 275c85105ed..a0ce7f3f5bc 100644 --- a/progs/demos/arbfslight.c +++ b/progs/demos/arbfslight.c @@ -311,9 +311,8 @@ static void Init (void) int main (int argc, char *argv[]) { - glutInit (&argc, argv); - glutInitWindowPosition ( 0, 0); glutInitWindowSize (200, 200); + glutInit (&argc, argv); glutInitDisplayMode (GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); glutCreateWindow (argv[0]); glutReshapeFunc (Reshape); diff --git a/progs/demos/arbocclude.c b/progs/demos/arbocclude.c index 9188ad5a565..f669a1f26ba 100644 --- a/progs/demos/arbocclude.c +++ b/progs/demos/arbocclude.c @@ -268,9 +268,8 @@ static void Init( void ) int main( int argc, char *argv[] ) { - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); glutInitWindowSize( 400, 400 ); + glutInit( &argc, argv ); glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ); Win = glutCreateWindow(argv[0]); glewInit(); diff --git a/progs/demos/bounce.c b/progs/demos/bounce.c index 436bc7d1fb8..a9a291e0a6f 100644 --- a/progs/demos/bounce.c +++ b/progs/demos/bounce.c @@ -192,10 +192,8 @@ visible(int vis) int main(int argc, char *argv[]) { - glutInit(&argc, argv); - glutInitWindowPosition(0, 0); glutInitWindowSize(600, 450); - + glutInit(&argc, argv); IndexMode = argc > 1 && strcmp(argv[1], "-ci") == 0; if (IndexMode) diff --git a/progs/demos/clearspd.c b/progs/demos/clearspd.c index 42953f6675e..c40f118a64b 100644 --- a/progs/demos/clearspd.c +++ b/progs/demos/clearspd.c @@ -187,9 +187,8 @@ int main( int argc, char *argv[] ) Init( argc, argv ); - glutInit( &argc, argv ); glutInitWindowSize( (int) Width, (int) Height ); - glutInitWindowPosition( 0, 0 ); + glutInit( &argc, argv ); mode = ColorMode | GLUT_DOUBLE; if (BufferMask & GL_STENCIL_BUFFER_BIT) diff --git a/progs/demos/copypix.c b/progs/demos/copypix.c index a13339ea62f..98c835f44f8 100644 --- a/progs/demos/copypix.c +++ b/progs/demos/copypix.c @@ -237,6 +237,9 @@ int main( int argc, char *argv[] ) const char *filename = IMAGE_FILE; int i = 1; + glutInitWindowSize( WinWidth, WinHeight ); + glutInit( &argc, argv ); + if (argc > i && strcmp(argv[i], "-ci")==0) { ciMode = GL_TRUE; i++; @@ -245,10 +248,6 @@ int main( int argc, char *argv[] ) filename = argv[i]; } - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( WinWidth, WinHeight ); - if (ciMode) glutInitDisplayMode( GLUT_INDEX | GLUT_DOUBLE ); else diff --git a/progs/demos/cubemap.c b/progs/demos/cubemap.c index 20332b1d960..3e79d6a5589 100644 --- a/progs/demos/cubemap.c +++ b/progs/demos/cubemap.c @@ -613,9 +613,8 @@ static void parse_args(int argc, char *argv[]) int main( int argc, char *argv[] ) { - glutInit(&argc, argv); - glutInitWindowPosition(0, 0); glutInitWindowSize(600, 500); + glutInit(&argc, argv); glutInitDisplayMode( GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE ); glutCreateWindow("Texture Cube Mapping"); glewInit(); diff --git a/progs/demos/drawpix.c b/progs/demos/drawpix.c index 5490bcc6355..9bc7086e04b 100644 --- a/progs/demos/drawpix.c +++ b/progs/demos/drawpix.c @@ -328,6 +328,9 @@ int main( int argc, char *argv[] ) const char *filename = IMAGE_FILE; int i = 1; + glutInitWindowSize( 500, 400 ); + glutInit( &argc, argv ); + if (argc > i && strcmp(argv[i], "-ci")==0) { ciMode = GL_TRUE; i++; @@ -336,10 +339,6 @@ int main( int argc, char *argv[] ) filename = argv[i]; } - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 500, 400 ); - if (ciMode) glutInitDisplayMode( GLUT_INDEX | GLUT_DOUBLE ); else diff --git a/progs/demos/engine.c b/progs/demos/engine.c index 3cf311e7782..c54e3b8fb80 100644 --- a/progs/demos/engine.c +++ b/progs/demos/engine.c @@ -1308,8 +1308,8 @@ Init(void) int main(int argc, char *argv[]) { - glutInit(&argc, argv); glutInitWindowSize(WinWidth, WinHeight); + glutInit(&argc, argv); glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); glutCreateWindow("OpenGL Engine Demo"); glewInit(); diff --git a/progs/demos/fbo_firecube.c b/progs/demos/fbo_firecube.c index 4e42924a09e..17767a148f9 100644 --- a/progs/demos/fbo_firecube.c +++ b/progs/demos/fbo_firecube.c @@ -938,7 +938,14 @@ reshape(int width, int height) static void init_fbotexture() { + static const GLenum depthFormats[] = { + GL_DEPTH_COMPONENT, + GL_DEPTH_COMPONENT16, + GL_DEPTH_COMPONENT32 + }; + static int numDepthFormats = sizeof(depthFormats) / sizeof(depthFormats[0]); GLint i; + GLenum stat; /* gen framebuffer id, delete it, do some assertions, just for testing */ glGenFramebuffersEXT(1, &MyFB); @@ -969,18 +976,31 @@ init_fbotexture() /* make depth renderbuffer */ glGenRenderbuffersEXT(1, &DepthRB); glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, DepthRB); - glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT16, - TexWidth, TexHeight); - CheckError(__LINE__); + /* we may have to try several formats */ + for (i = 0; i < numDepthFormats; i++) { + glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, depthFormats[i], + TexWidth, TexHeight); + CheckError(__LINE__); + + glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, + GL_RENDERBUFFER_EXT, DepthRB); + CheckError(__LINE__); + stat = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); + if (stat == GL_FRAMEBUFFER_COMPLETE_EXT) { + break; + } + } + + if (stat != GL_FRAMEBUFFER_COMPLETE_EXT) { + fprintf(stderr, "Error: unable to get usable FBO combination!\n"); + exit(1); + } + glGetRenderbufferParameterivEXT(GL_RENDERBUFFER_EXT, - GL_RENDERBUFFER_DEPTH_SIZE_EXT, &i); + GL_RENDERBUFFER_DEPTH_SIZE_EXT, &i); CheckError(__LINE__); printf("Depth renderbuffer size = %d bits\n", i); - /* attach DepthRB to MyFB */ - glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, - GL_RENDERBUFFER_EXT, DepthRB); - CheckError(__LINE__); glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); /* @@ -1031,11 +1051,11 @@ visible(int vis) int main(int argc, char *argv[]) { + glutInitWindowSize(WinWidth, WinHeight); glutInit(&argc, argv); glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE); - glutInitWindowSize(WinWidth, WinHeight); Win = glutCreateWindow("fbo_firecube"); glewInit(); init(argc, argv); diff --git a/progs/demos/fire.c b/progs/demos/fire.c index dd70f6141db..3db45418fad 100644 --- a/progs/demos/fire.c +++ b/progs/demos/fire.c @@ -733,7 +733,6 @@ main(int ac, char **av) HEIGHT = atoi(av[3]); } - glutInitWindowPosition(0, 0); glutInitWindowSize(WIDTH, HEIGHT); glutInit(&ac, av); diff --git a/progs/demos/fogcoord.c b/progs/demos/fogcoord.c index 6f50993c98f..336aa580755 100644 --- a/progs/demos/fogcoord.c +++ b/progs/demos/fogcoord.c @@ -15,8 +15,6 @@ #define DEPTH 5.0f -static PFNGLFOGCOORDPOINTEREXTPROC glFogCoordPointer_ext; - static GLfloat camz; static GLint fogMode; @@ -406,8 +404,8 @@ Init(void) int main( int argc, char *argv[] ) { - glutInit( &argc, argv ); glutInitWindowSize( 600, 600 ); + glutInit( &argc, argv ); glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ); glutCreateWindow(argv[0]); glewInit(); diff --git a/progs/demos/fplight.c b/progs/demos/fplight.c index c297354103f..f52a4f78686 100644 --- a/progs/demos/fplight.c +++ b/progs/demos/fplight.c @@ -268,9 +268,8 @@ static void Init( void ) int main( int argc, char *argv[] ) { - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); glutInitWindowSize( 200, 200 ); + glutInit( &argc, argv ); glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ); Win = glutCreateWindow(argv[0]); glewInit(); diff --git a/progs/demos/fslight.c b/progs/demos/fslight.c index f0d76a4a06f..395b7caa2c1 100644 --- a/progs/demos/fslight.c +++ b/progs/demos/fslight.c @@ -353,6 +353,7 @@ MakeSphere(void) glNewList(SphereList, GL_COMPILE); gluSphere(obj, 2.0f, 10, 5); glEndList(); + gluDeleteQuadric(obj); } static void @@ -599,9 +600,8 @@ ParseOptions(int argc, char *argv[]) int main(int argc, char *argv[]) { - glutInit(&argc, argv); - glutInitWindowPosition( 0, 0); glutInitWindowSize(200, 200); + glutInit(&argc, argv); glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); win = glutCreateWindow(argv[0]); glutReshapeFunc(Reshape); diff --git a/progs/demos/gamma.c b/progs/demos/gamma.c index 9b2c3e1052b..61c6d125fbe 100644 --- a/progs/demos/gamma.c +++ b/progs/demos/gamma.c @@ -146,12 +146,9 @@ display(void) int main(int argc, char **argv) { + glutInitWindowSize(500, 400); glutInit(&argc, argv); glutInitDisplayMode(GLUT_RGB | GLUT_SINGLE); - - glutInitWindowPosition(50, 50); - glutInitWindowSize(500, 400); - glutCreateWindow("gamma test patterns"); glutReshapeFunc(Reshape); glutDisplayFunc(display); diff --git a/progs/demos/gearbox.c b/progs/demos/gearbox.c index 2dcf32f92ff..71d0281904b 100644 --- a/progs/demos/gearbox.c +++ b/progs/demos/gearbox.c @@ -474,10 +474,10 @@ visible(int vis) int main(int argc, char *argv[]) { + glutInitWindowSize(WinWidth, WinHeight); glutInit(&argc, argv); glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE); - glutInitWindowSize(WinWidth, WinHeight); Win = glutCreateWindow("gearbox"); init(argc, argv); diff --git a/progs/demos/gears.c b/progs/demos/gears.c index 6016162d6f7..31a5b79eab9 100644 --- a/progs/demos/gears.c +++ b/progs/demos/gears.c @@ -385,11 +385,9 @@ visible(int vis) int main(int argc, char *argv[]) { + glutInitWindowSize(300, 300); glutInit(&argc, argv); glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE); - - glutInitWindowPosition(0, 0); - glutInitWindowSize(300, 300); win = glutCreateWindow("Gears"); init(argc, argv); diff --git a/progs/demos/geartrain.c b/progs/demos/geartrain.c index 8fe405e8076..00b6e78b724 100644 --- a/progs/demos/geartrain.c +++ b/progs/demos/geartrain.c @@ -25,6 +25,7 @@ */ +#include <assert.h> #include <math.h> #include <stdlib.h> #include <GL/glut.h> @@ -129,8 +130,10 @@ Clear_Buffers () static void LoadTriplet (TDA A) { + int result; Clear_Buffers (); - fscanf (mainfile, "%s %s %s %s", Buf1, Buf2, Buf3, Buf4); + result = fscanf (mainfile, "%s %s %s %s", Buf1, Buf2, Buf3, Buf4); + assert(result != EOF); A[0] = atof (Buf2); A[1] = atof (Buf3); A[2] = atof (Buf4); @@ -140,8 +143,10 @@ LoadTriplet (TDA A) static void LoadReal (float *a) { + int result; Clear_Buffers (); - fscanf (mainfile, "%s %s", Buf1, Buf2); + result = fscanf (mainfile, "%s %s", Buf1, Buf2); + assert(result != EOF); *a = atof (Buf2); } @@ -149,8 +154,10 @@ LoadReal (float *a) static void LoadInteger (int *a) { + int result; Clear_Buffers (); - fscanf (mainfile, "%s %s", Buf1, Buf2); + result = fscanf (mainfile, "%s %s", Buf1, Buf2); + assert(result != EOF); *a = atoi (Buf2); } @@ -158,8 +165,10 @@ LoadInteger (int *a) static void LoadText (char *a) { + int result; Clear_Buffers (); - fscanf (mainfile, "%s %s", Buf1, Buf2); + result = fscanf (mainfile, "%s %s", Buf1, Buf2); + assert(result != EOF); strcpy (a, Buf2); } @@ -177,8 +186,10 @@ getdata (char filename[]) do { + int result; Clear_Buffers (); - fscanf (mainfile, "%s", Buf1); + result = fscanf (mainfile, "%s", Buf1); + (void) result; if (ferror (mainfile)) { printf ("\nError opening file !\n"); @@ -1049,19 +1060,18 @@ main (int argc, char *argv[]) { char *file; - if (argc < 2) - file = "geartrain.dat"; - else - file = argv[1]; - - glutInit(&argc, argv); - glutInitWindowPosition (0, 0); glutInitWindowSize(640,480); + glutInit(&argc, argv); glutInitDisplayMode (GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE ); if (glutCreateWindow ("Gear Train Simulation") == GL_FALSE) exit (1); + if (argc < 2) + file = "geartrain.dat"; + else + file = argv[1]; + getdata (file); process (); init (); diff --git a/progs/demos/gloss.c b/progs/demos/gloss.c index d32e8f8c68b..450861e5778 100644 --- a/progs/demos/gloss.c +++ b/progs/demos/gloss.c @@ -441,8 +441,8 @@ static void Init( int argc, char *argv[] ) int main( int argc, char *argv[] ) { - glutInit( &argc, argv ); glutInitWindowSize(WinWidth, WinHeight); + glutInit( &argc, argv ); glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ); Win = glutCreateWindow(argv[0] ); glewInit(); diff --git a/progs/demos/gltestperf.c b/progs/demos/gltestperf.c index 2188b024192..3658a395988 100644 --- a/progs/demos/gltestperf.c +++ b/progs/demos/gltestperf.c @@ -569,10 +569,9 @@ main(int ac, char **av) if (ac == 2) frontbuffer = 0; + glutInitWindowSize(640, 480); glutInit(&ac, av); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); - glutInitWindowPosition(0, 0); - glutInitWindowSize(640, 480); glutCreateWindow("OpenGL/Mesa Performances"); glutDisplayFunc(display); glutMainLoop(); diff --git a/progs/demos/ipers.c b/progs/demos/ipers.c index 5d82b0dc924..265378b90a9 100644 --- a/progs/demos/ipers.c +++ b/progs/demos/ipers.c @@ -133,6 +133,8 @@ initdlists(void) glEndList(); } + + gluDeleteQuadric(obj); } static void @@ -680,7 +682,6 @@ main(int ac, char **av) fprintf(stderr, "IperS V1.0\nWritten by David Bucciarelli ([email protected])\n"); - glutInitWindowPosition(0, 0); glutInitWindowSize(WIDTH, HEIGHT); glutInit(&ac, av); diff --git a/progs/demos/isosurf.c b/progs/demos/isosurf.c index 2e9dff17261..dbe4d8d172a 100644 --- a/progs/demos/isosurf.c +++ b/progs/demos/isosurf.c @@ -132,9 +132,11 @@ static void read_surface( char *filename ) numverts = 0; while (!feof(f) && numverts<maxverts) { - fscanf( f, "%f %f %f %f %f %f", - &data[numverts][0], &data[numverts][1], &data[numverts][2], - &data[numverts][3], &data[numverts][4], &data[numverts][5] ); + int result; + result = fscanf( f, "%f %f %f %f %f %f", + &data[numverts][0], &data[numverts][1], &data[numverts][2], + &data[numverts][3], &data[numverts][4], &data[numverts][5] ); + (void) result; numverts++; } numverts--; @@ -1061,9 +1063,8 @@ int main(int argc, char **argv) read_surface( "isosurf.dat" ); - glutInit( &argc, argv); - glutInitWindowPosition(0, 0); glutInitWindowSize(400, 400); + glutInit( &argc, argv); type = GLUT_DEPTH; type |= GLUT_RGB; diff --git a/progs/demos/lodbias.c b/progs/demos/lodbias.c index 8d39bd605a7..23488b1616e 100644 --- a/progs/demos/lodbias.c +++ b/progs/demos/lodbias.c @@ -282,9 +282,8 @@ static void Init( void ) int main( int argc, char *argv[] ) { - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); glutInitWindowSize( 350, 350 ); + glutInit( &argc, argv ); glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE ); win = glutCreateWindow(argv[0]); glutReshapeFunc( Reshape ); diff --git a/progs/demos/morph3d.c b/progs/demos/morph3d.c index 6aca8270ff5..0f8ac426f33 100644 --- a/progs/demos/morph3d.c +++ b/progs/demos/morph3d.c @@ -841,9 +841,8 @@ int main(int argc, char **argv) object=1; - glutInit(&argc, argv); - glutInitWindowPosition(0,0); glutInitWindowSize(640,480); + glutInit(&argc, argv); glutInitDisplayMode( GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGB ); @@ -887,5 +886,6 @@ int main(int argc, char **argv) glutIdleFunc( idle_ ); glutDisplayFunc( draw ); glutMainLoop(); - + + return 0; } diff --git a/progs/demos/multiarb.c b/progs/demos/multiarb.c index 85c4e3a266c..82796a0c3f4 100644 --- a/progs/demos/multiarb.c +++ b/progs/demos/multiarb.c @@ -27,6 +27,8 @@ #define ANIMATE 10 #define QUIT 100 +static GLint T0 = 0; +static GLint Frames = 0; static GLboolean Animate = GL_TRUE; static GLint NumUnits = 1; static GLboolean TexEnabled[8]; @@ -105,6 +107,20 @@ static void Display( void ) glPopMatrix(); glutSwapBuffers(); + + Frames++; + + { + GLint t = glutGet(GLUT_ELAPSED_TIME); + if (t - T0 >= 5000) { + GLfloat seconds = (t - T0) / 1000.0; + GLfloat fps = Frames / seconds; + printf("%d frames in %6.3f seconds = %6.3f FPS\n", Frames, seconds, fps); + fflush(stdout); + T0 = t; + Frames = 0; + } + } } @@ -322,9 +338,8 @@ int main( int argc, char *argv[] ) { GLint i; - glutInit( &argc, argv ); glutInitWindowSize( 300, 300 ); - glutInitWindowPosition( 0, 0 ); + glutInit( &argc, argv ); glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE ); glutCreateWindow(argv[0] ); glewInit(); diff --git a/progs/demos/paltex.c b/progs/demos/paltex.c index d0cbcfb5e9a..5d4b8662b5c 100644 --- a/progs/demos/paltex.c +++ b/progs/demos/paltex.c @@ -248,12 +248,9 @@ static void Init2( void ) int main( int argc, char *argv[] ) { - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); glutInitWindowSize( 400, 300 ); - + glutInit( &argc, argv ); glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE ); - glutCreateWindow(argv[0]); glewInit(); diff --git a/progs/demos/pointblast.c b/progs/demos/pointblast.c index 2d70b725894..b4d0a67f993 100644 --- a/progs/demos/pointblast.c +++ b/progs/demos/pointblast.c @@ -427,10 +427,10 @@ int main(int argc, char **argv) { int i; + + glutInitWindowSize(300, 300); glutInit(&argc, argv); glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH | GLUT_MULTISAMPLE); - glutInitWindowPosition(0, 0); - glutInitWindowSize(300, 300); for (i=1; i<argc; i++) { if(!strcmp("-noms", argv[i])) { diff --git a/progs/demos/projtex.c b/progs/demos/projtex.c index 99154d7bdc8..d162568b9f0 100644 --- a/progs/demos/projtex.c +++ b/progs/demos/projtex.c @@ -245,6 +245,10 @@ loadImageTextures(void) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); } glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, borderColor); + + free(texData3); + free(texData4); + free(image); } } @@ -994,18 +998,17 @@ menu(int selection) int main(int argc, char **argv) { + glutInitWindowSize(500,500); glutInit(&argc, argv); + glutInitDisplayMode(GLUT_RGBA | GLUT_DEPTH | GLUT_DOUBLE); + (void) glutCreateWindow("projtex"); + glewInit(); if (argc > 1) { NumTextures = atoi(argv[1]); } assert(NumTextures <= MAX_TEX); - glutInitDisplayMode(GLUT_RGBA | GLUT_DEPTH | GLUT_DOUBLE); - glutInitWindowSize(500,500); - (void) glutCreateWindow("projtex"); - glewInit(); - loadTexture = loadImageTextures; drawObject = drawCube; initialize(); diff --git a/progs/demos/ray.c b/progs/demos/ray.c index c2d8e4f545e..9cc464d2390 100644 --- a/progs/demos/ray.c +++ b/progs/demos/ray.c @@ -834,6 +834,8 @@ initdlists(void) gluQuadricTexture(obj, GL_TRUE); gluSphere(obj, SPHERE_RADIUS, 16, 16); glEndList(); + + gluDeleteQuadric(obj); } int @@ -854,7 +856,6 @@ main(int ac, char **av) } */ - glutInitWindowPosition(0, 0); glutInitWindowSize(WIDTH, HEIGHT); glutInit(&ac, av); diff --git a/progs/demos/readpix.c b/progs/demos/readpix.c index bbb3a68effa..cc4e4902694 100644 --- a/progs/demos/readpix.c +++ b/progs/demos/readpix.c @@ -219,7 +219,7 @@ Display( void ) GLint reads = 0; GLint endTime; GLint startTime = glutGet(GLUT_ELAPSED_TIME); - GLdouble seconds, pixelsPerSecond; + GLdouble seconds, mpixels, mpixelsPerSecond; printf("Benchmarking...\n"); do { glReadPixels(APosX, APosY, ImgWidth, ImgHeight, @@ -228,9 +228,10 @@ Display( void ) endTime = glutGet(GLUT_ELAPSED_TIME); } while (endTime - startTime < 4000); /* 4 seconds */ seconds = (double) (endTime - startTime) / 1000.0; - pixelsPerSecond = reads * ImgWidth * ImgHeight / seconds; - printf("Result: %d reads in %f seconds = %f pixels/sec\n", - reads, seconds, pixelsPerSecond); + mpixels = reads * (ImgWidth * ImgHeight / (1000.0 * 1000.0)); + mpixelsPerSecond = mpixels / seconds; + printf("Result: %d reads in %f seconds = %f Mpixels/sec\n", + reads, seconds, mpixelsPerSecond); Benchmark = GL_FALSE; } else { @@ -382,12 +383,11 @@ int main( int argc, char *argv[] ) { GLboolean ciMode = GL_FALSE; + glutInitWindowSize( 750, 250 ); + glutInit( &argc, argv ); if (argc > 1 && strcmp(argv[1], "-ci")==0) { ciMode = GL_TRUE; } - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 750, 250 ); if (ciMode) glutInitDisplayMode( GLUT_INDEX | GLUT_DOUBLE ); else diff --git a/progs/demos/renormal.c b/progs/demos/renormal.c index 9e5da95484c..61dd860ddbe 100644 --- a/progs/demos/renormal.c +++ b/progs/demos/renormal.c @@ -112,12 +112,9 @@ key(unsigned char k, int x, int y) int main( int argc, char *argv[] ) { - glutInit( &argc, argv ); - glutInitWindowPosition(0, 0); glutInitWindowSize( 400, 400 ); - + glutInit( &argc, argv ); glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE ); - glutCreateWindow(argv[0]); Init(); diff --git a/progs/demos/shadowtex.c b/progs/demos/shadowtex.c index dc5a4bbc480..036f73d40b6 100644 --- a/progs/demos/shadowtex.c +++ b/progs/demos/shadowtex.c @@ -1022,9 +1022,8 @@ PrintHelp(void) int main(int argc, char *argv[]) { - glutInit(&argc, argv); - glutInitWindowPosition(0, 0); glutInitWindowSize(WindowWidth, WindowHeight); + glutInit(&argc, argv); glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH | GLUT_STENCIL); glutCreateWindow(argv[0]); glewInit(); diff --git a/progs/demos/spectex.c b/progs/demos/spectex.c index 6ab1191579c..c1dada9d634 100644 --- a/progs/demos/spectex.c +++ b/progs/demos/spectex.c @@ -239,13 +239,9 @@ static void ModeMenu(int entry) int main( int argc, char *argv[] ) { - - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); glutInitWindowSize( 300, 300 ); - + glutInit( &argc, argv ); glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ); - glutCreateWindow( "spectex" ); Init(); diff --git a/progs/demos/spriteblast.c b/progs/demos/spriteblast.c index d73b680b791..36e226e1d07 100644 --- a/progs/demos/spriteblast.c +++ b/progs/demos/spriteblast.c @@ -493,6 +493,8 @@ int main(int argc, char **argv) { int i; + + glutInitWindowSize(600,300); glutInit(&argc, argv); glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH | GLUT_MULTISAMPLE); @@ -506,8 +508,6 @@ main(int argc, char **argv) linearFiltering = 0; } } - glutInitWindowPosition(0, 0); - glutInitWindowSize(600,300); glutCreateWindow("sprite blast"); glewInit(); glutReshapeFunc(reshape); diff --git a/progs/demos/teapot.c b/progs/demos/teapot.c index 6bf6e064095..04a675f36e6 100644 --- a/progs/demos/teapot.c +++ b/progs/demos/teapot.c @@ -638,7 +638,6 @@ int main(int ac, char **av) } */ - glutInitWindowPosition(0,0); glutInitWindowSize(WIDTH,HEIGHT); glutInit(&ac,av); diff --git a/progs/demos/terrain.c b/progs/demos/terrain.c index be78ea4950f..a72c8d3caea 100644 --- a/progs/demos/terrain.c +++ b/progs/demos/terrain.c @@ -8,6 +8,7 @@ * based on a Mikael SkiZoWalker's (MoDEL) / France ([email protected]) demo */ +#include <assert.h> #include <stdio.h> #include <math.h> #include <stdlib.h> @@ -559,12 +560,14 @@ loadpic(void) FILE *FilePic; int i, tmp; GLenum gluerr; + size_t result; if ((FilePic = fopen("terrain.dat", "r")) == NULL) { fprintf(stderr, "Error loading terrain.dat\n"); exit(-1); } - fread(bufferter, 256 * 256, 1, FilePic); + result = fread(bufferter, 256 * 256, 1, FilePic); + assert(result == 1); fclose(FilePic); for (i = 0; i < (256 * 256); i++) { @@ -623,7 +626,6 @@ init(void) int main(int ac, char **av) { - glutInitWindowPosition(0, 0); glutInitWindowSize(WIDTH, HEIGHT); glutInit(&ac, av); diff --git a/progs/demos/tessdemo.c b/progs/demos/tessdemo.c index f71cea12744..8b988e36c13 100644 --- a/progs/demos/tessdemo.c +++ b/progs/demos/tessdemo.c @@ -503,10 +503,9 @@ int main( int argc, char **argv ) usage(); + glutInitWindowSize( 400, 400 ); glutInit( &argc, argv ); glutInitDisplayMode( GLUT_SINGLE | GLUT_RGB ); - glutInitWindowPosition(0, 0); - glutInitWindowSize( 400, 400 ); glutCreateWindow( argv[0] ); /* GH: Bit of a hack... diff --git a/progs/demos/texcyl.c b/progs/demos/texcyl.c index 0e6089bced5..4df97ec4f50 100644 --- a/progs/demos/texcyl.c +++ b/progs/demos/texcyl.c @@ -261,10 +261,8 @@ static void Init( int argc, char *argv[] ) int main( int argc, char *argv[] ) { - glutInit( &argc, argv ); glutInitWindowSize( 400, 400 ); - glutInitWindowPosition( 0, 0 ); - + glutInit( &argc, argv ); glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE ); Win = glutCreateWindow(argv[0] ); diff --git a/progs/demos/texenv.c b/progs/demos/texenv.c index c5a8b13f35f..260ca8718f0 100644 --- a/progs/demos/texenv.c +++ b/progs/demos/texenv.c @@ -765,6 +765,7 @@ int main( int argc, char *argv[] ) GLboolean info = GL_FALSE; int i; + glutInitWindowSize( winWidth, winHeight ); glutInit( &argc, argv ); for ( i = 1 ; i < argc ; i++ ) { @@ -786,8 +787,6 @@ int main( int argc, char *argv[] ) glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE ); } - glutInitWindowSize( winWidth, winHeight ); - glutInitWindowPosition( 0, 0 ); Win = glutCreateWindow( "Texture Environment Test" ); initialize(); diff --git a/progs/demos/textures.c b/progs/demos/textures.c index b7bf135d219..1415ef1c43c 100644 --- a/progs/demos/textures.c +++ b/progs/demos/textures.c @@ -57,7 +57,7 @@ Idle(void) { Xrot = glutGet(GLUT_ELAPSED_TIME) * 0.02; Yrot = glutGet(GLUT_ELAPSED_TIME) * 0.04; - //Zrot += 2.0; + /* Zrot += 2.0; */ glutPostRedisplay(); } @@ -356,9 +356,8 @@ Usage(void) int main(int argc, char *argv[]) { - glutInit(&argc, argv); - glutInitWindowPosition(0, 0); glutInitWindowSize(700, 700); + glutInit(&argc, argv); glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); Win = glutCreateWindow(argv[0]); glutReshapeFunc(Reshape); diff --git a/progs/demos/trispd.c b/progs/demos/trispd.c index 165d088e3d3..c07c3409472 100644 --- a/progs/demos/trispd.c +++ b/progs/demos/trispd.c @@ -227,15 +227,12 @@ static void Help( const char *program ) int main( int argc, char *argv[] ) { - printf("For options: %s -help\n", argv[0]); - glutInit( &argc, argv ); glutInitWindowSize( (int) Width, (int) Height ); - glutInitWindowPosition( 0, 0 ); - + glutInit( &argc, argv ); glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ); - glutCreateWindow( argv[0] ); + printf("For options: %s -help\n", argv[0]); if (argc==2 && strcmp(argv[1],"-help")==0) { Help(argv[0]); return 0; diff --git a/progs/demos/tunnel.c b/progs/demos/tunnel.c index 6981da32988..efc007c79aa 100644 --- a/progs/demos/tunnel.c +++ b/progs/demos/tunnel.c @@ -491,7 +491,6 @@ main(int ac, char **av) fprintf(stderr, "Tunnel V1.5\nWritten by David Bucciarelli ([email protected])\n"); - glutInitWindowPosition(0, 0); glutInitWindowSize(WIDTH, HEIGHT); glutInit(&ac, av); diff --git a/progs/demos/tunnel2.c b/progs/demos/tunnel2.c index 0288ea0f8ce..f15da95b18b 100644 --- a/progs/demos/tunnel2.c +++ b/progs/demos/tunnel2.c @@ -559,7 +559,6 @@ main(int ac, char **av) fprintf(stderr, "Tunnel2 V1.0\nWritten by David Bucciarelli ([email protected])\n"); - glutInitWindowPosition(0, 0); glutInitWindowSize(WIDTHC0, HEIGHTC0); glutInit(&ac, av); diff --git a/progs/demos/vao_demo.c b/progs/demos/vao_demo.c index 206e06fc6c7..5ce07ecc63b 100644 --- a/progs/demos/vao_demo.c +++ b/progs/demos/vao_demo.c @@ -317,9 +317,8 @@ static void Init( void ) int main( int argc, char *argv[] ) { - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); glutInitWindowSize( Width, Height ); + glutInit( &argc, argv ); glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ); Win = glutCreateWindow( "GL_APPLE_vertex_array_object demo" ); glutReshapeFunc( Reshape ); diff --git a/progs/demos/winpos.c b/progs/demos/winpos.c index 13a9c7e9a8f..f935f9bee0f 100644 --- a/progs/demos/winpos.c +++ b/progs/demos/winpos.c @@ -96,9 +96,8 @@ static void init( void ) int main( int argc, char *argv[] ) { - glutInit(&argc, argv); - glutInitWindowPosition(0, 0); glutInitWindowSize(500, 500); + glutInit(&argc, argv); glutInitDisplayMode( GLUT_RGB ); if (glutCreateWindow("winpos") <= 0) { |