-/* $Id: stex3d.c,v 1.8 2003/03/29 16:40:23 brianp Exp $ */
-
/*-----------------------------
* stex3d.c GL example of the mesa 3d-texture extention to simulate procedural
* texturing, it uses a perlin noise and turbulence functions.
static int tex_width=64, tex_height=64, tex_depth=64;
static float angx=0, angy=0, angz=0;
-static GLuint DList;
-static int texgen = 2, animate = 1, smooth = 1;
+static int texgen = 2, animate = 1, smooth = 1, wireframe = 0;
static int CurTexture = NOISE_TEXTURE, CurObject = TORUS;
GLint i;
for (i = 1; i < argc; i++) {
- if (strstr(argv[i], "-w") == 0) {
+ if (strcmp(argv[i], "-help") == 0) {
+ printHelp();
+ return GL_FALSE;
+ }
+ else if (strstr(argv[i], "-w") != NULL) {
tex_width = atoi((argv[i]) + 2);
}
- else if (strstr(argv[i], "-h") == 0) {
+ else if (strstr(argv[i], "-h") != NULL) {
tex_height = atoi((argv[i]) + 2);
}
- else if (strstr(argv[i], "-d") == 0) {
+ else if (strstr(argv[i], "-d") != NULL) {
tex_depth = atoi((argv[i]) + 2);
}
- else if (strcmp(argv[i], "-help") == 0) {
- printHelp();
- return GL_FALSE;
- }
else {
printf("%s (Bad option).\n", argv[i]);
printHelp();
else
glutIdleFunc(NULL);
break;
+ case 'w':
+ wireframe = !wireframe;
+ if (wireframe)
+ glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
+ else
+ glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
+ break;
default:
break;
}
}
-void
+static void
create3Dgradient(void)
{
unsigned char *v;
glClearColor(.5, .5, .5, 0);
- /* create torus for texturing */
- DList = glGenLists(1);
-
- glNewList(SPHERE, GL_COMPILE);
- glutSolidSphere(0.95, 30, 15);
- glEndList();
+ {
+ GLUquadricObj *q;
+ q = gluNewQuadric();
+ gluQuadricTexture( q, GL_TRUE );
+ glNewList(SPHERE, GL_COMPILE);
+ gluSphere( q, 0.95, 30, 15 );
+ glEndList();
+ gluDeleteQuadric(q);
+ }
BuildTorus();