@@ -1,8 +1,12 @@ | |||
/* $Id: gears.c,v 1.1 1999/08/19 00:55:40 jtg Exp $ */ | |||
/* $Id: gears.c,v 1.2 1999/10/21 16:39:06 brianp Exp $ */ | |||
/* | |||
* 3-D gear wheels. This program is in the public domain. | |||
* | |||
* Command line options: | |||
* -info print GL implementation information | |||
* | |||
* | |||
* Brian Paul | |||
*/ | |||
@@ -10,8 +14,11 @@ | |||
/* | |||
* $Log: gears.c,v $ | |||
* Revision 1.1 1999/08/19 00:55:40 jtg | |||
* Initial revision | |||
* Revision 1.2 1999/10/21 16:39:06 brianp | |||
* added -info command line option | |||
* | |||
* Revision 1.1.1.1 1999/08/19 00:55:40 jtg | |||
* Imported sources | |||
* | |||
* Revision 3.2 1999/06/03 17:07:36 brianp | |||
* an extra quad was being drawn in front and back faces | |||
@@ -28,6 +35,7 @@ | |||
#include <math.h> | |||
#include <stdlib.h> | |||
#include <stdio.h> | |||
#include <string.h> | |||
#include <GL/glut.h> | |||
#ifndef M_PI | |||
@@ -287,7 +295,7 @@ reshape(int width, int height) | |||
} | |||
static void | |||
init(void) | |||
init(int argc, char *argv[]) | |||
{ | |||
static GLfloat pos[4] = | |||
{5.0, 5.0, 10.0, 0.0}; | |||
@@ -324,6 +332,13 @@ init(void) | |||
glEndList(); | |||
glEnable(GL_NORMALIZE); | |||
if (argc > 1 && strcmp(argv[1], "-info")==0) { | |||
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); | |||
printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); | |||
printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); | |||
printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS)); | |||
} | |||
} | |||
void | |||
@@ -343,7 +358,7 @@ int main(int argc, char *argv[]) | |||
glutInitWindowPosition(0, 0); | |||
glutInitWindowSize(300, 300); | |||
glutCreateWindow("Gears"); | |||
init(); | |||
init(argc, argv); | |||
glutDisplayFunc(draw); | |||
glutReshapeFunc(reshape); |
@@ -1,8 +1,11 @@ | |||
/* $Id: isosurf.c,v 1.3 1999/09/08 22:14:31 brianp Exp $ */ | |||
/* $Id: isosurf.c,v 1.4 1999/10/21 16:39:06 brianp Exp $ */ | |||
/* | |||
* Display an isosurface of 3-D wind speed volume. | |||
* | |||
* Command line options: | |||
* -info print GL implementation information | |||
* | |||
* Brian Paul This file in public domain. | |||
*/ | |||
@@ -24,6 +27,9 @@ | |||
/* | |||
* $Log: isosurf.c,v $ | |||
* Revision 1.4 1999/10/21 16:39:06 brianp | |||
* added -info command line option | |||
* | |||
* Revision 1.3 1999/09/08 22:14:31 brianp | |||
* minor changes. always call compactify_arrays() | |||
* | |||
@@ -49,6 +55,7 @@ | |||
#include <stdio.h> | |||
#include <string.h> | |||
#include <stdlib.h> | |||
#include <string.h> | |||
#include <math.h> | |||
#include "GL/glut.h" | |||
@@ -109,6 +116,8 @@ static GLboolean doubleBuffer = GL_TRUE; | |||
static GLdouble plane[4] = {1.0, 0.0, -1.0, 0.0}; | |||
static GLuint surf1; | |||
static GLboolean PrintInfo = GL_FALSE; | |||
/* forward decl */ | |||
int BuildList( int mode ); | |||
@@ -147,7 +156,7 @@ struct data_idx { | |||
#define COMPARE_FUNC( AXIS ) \ | |||
int compare_axis_##AXIS( const void *a, const void *b ) \ | |||
static int compare_axis_##AXIS( const void *a, const void *b ) \ | |||
{ \ | |||
float t = ( (*(struct data_idx *)a).data[AXIS] - \ | |||
(*(struct data_idx *)b).data[AXIS] ); \ | |||
@@ -644,7 +653,7 @@ static void ModeMenu(int m) | |||
static void Init(void) | |||
static void Init(int argc, char *argv[]) | |||
{ | |||
GLfloat fogColor[4] = {0.5,1.0,0.5,1.0}; | |||
@@ -698,6 +707,13 @@ static void Init(void) | |||
NO_MATERIALS| | |||
NO_FOG| | |||
GLVERTEX); | |||
if (PrintInfo) { | |||
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); | |||
printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); | |||
printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); | |||
printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS)); | |||
} | |||
} | |||
@@ -808,6 +824,9 @@ static GLint Args(int argc, char **argv) | |||
else if (strcmp(argv[i], "-db") == 0) { | |||
doubleBuffer = GL_TRUE; | |||
} | |||
else if (strcmp(argv[i], "-info") == 0) { | |||
PrintInfo = GL_TRUE; | |||
} | |||
else { | |||
printf("%s (Bad option).\n", argv[i]); | |||
return QUIT; | |||
@@ -855,7 +874,7 @@ int main(int argc, char **argv) | |||
allowed &= ~COMPILED; | |||
} | |||
Init(); | |||
Init(argc, argv); | |||
ModeMenu(arg_mode); | |||
glutCreateMenu(ModeMenu); |
@@ -1,12 +1,20 @@ | |||
/* $Id: multiarb.c,v 1.2 1999/10/13 12:02:13 brianp Exp $ */ | |||
/* $Id: multiarb.c,v 1.3 1999/10/21 16:40:32 brianp Exp $ */ | |||
/* | |||
* GL_ARB_multitexture demo | |||
* | |||
* Command line options: | |||
* -info print GL implementation information | |||
* | |||
* | |||
* Brian Paul November 1998 This program is in the public domain. | |||
*/ | |||
/* | |||
* $Log: multiarb.c,v $ | |||
* Revision 1.3 1999/10/21 16:40:32 brianp | |||
* added -info command line option | |||
* | |||
* Revision 1.2 1999/10/13 12:02:13 brianp | |||
* use texture objects now | |||
* | |||
@@ -224,7 +232,7 @@ static void SpecialKey( int key, int x, int y ) | |||
} | |||
static void Init( void ) | |||
static void Init( int argc, char *argv[] ) | |||
{ | |||
GLuint texObj[2]; | |||
@@ -289,6 +297,13 @@ static void Init( void ) | |||
glClearColor(0.3, 0.3, 0.4, 1.0); | |||
ModeMenu(TEXBOTH); | |||
if (argc > 1 && strcmp(argv[1], "-info")==0) { | |||
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); | |||
printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); | |||
printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); | |||
printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS)); | |||
} | |||
} | |||
@@ -299,7 +314,7 @@ int main( int argc, char *argv[] ) | |||
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE ); | |||
glutCreateWindow(argv[0] ); | |||
Init(); | |||
Init( argc, argv ); | |||
glutReshapeFunc( Reshape ); | |||
glutKeyboardFunc( Key ); |
@@ -1,14 +1,22 @@ | |||
/* $Id: texcyl.c,v 1.1 1999/08/19 00:55:40 jtg Exp $ */ | |||
/* $Id: texcyl.c,v 1.2 1999/10/21 16:39:06 brianp Exp $ */ | |||
/* | |||
* Textured cylinder demo: lighting, texturing, reflection mapping. | |||
* | |||
* Command line options: | |||
* -info print GL implementation information | |||
* | |||
* | |||
* Brian Paul May 1997 This program is in the public domain. | |||
*/ | |||
/* | |||
* $Log: texcyl.c,v $ | |||
* Revision 1.1 1999/08/19 00:55:40 jtg | |||
* Initial revision | |||
* Revision 1.2 1999/10/21 16:39:06 brianp | |||
* added -info command line option | |||
* | |||
* Revision 1.1.1.1 1999/08/19 00:55:40 jtg | |||
* Imported sources | |||
* | |||
* Revision 3.3 1999/03/28 18:24:37 brianp | |||
* minor clean-up | |||
@@ -171,7 +179,7 @@ static void SpecialKey( int key, int x, int y ) | |||
} | |||
static void Init( void ) | |||
static void Init( int argc, char *argv[] ) | |||
{ | |||
GLUquadricObj *q = gluNewQuadric(); | |||
CylinderObj = glGenLists(1); | |||
@@ -226,6 +234,13 @@ static void Init( void ) | |||
glEnable(GL_CULL_FACE); /* don't need Z testing for convex objects */ | |||
SetMode(LIT); | |||
if (argc > 1 && strcmp(argv[1], "-info")==0) { | |||
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); | |||
printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); | |||
printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); | |||
printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS)); | |||
} | |||
} | |||
@@ -238,7 +253,7 @@ int main( int argc, char *argv[] ) | |||
glutCreateWindow(argv[0] ); | |||
Init(); | |||
Init(argc, argv); | |||
glutReshapeFunc( Reshape ); | |||
glutKeyboardFunc( Key ); |