X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=progs%2Fdemos%2Fstex3d.c;h=2350532c9815bff77c2d954dba1096cdce23f411;hb=5b0a7f397104ff1938908410b422e529120acde5;hp=2a35ca161f5ad36424fe31f2be3e45e29a894ce7;hpb=ecaf1a0865e24d4f3f82cf076c54c033f68a4914;p=mesa.git diff --git a/progs/demos/stex3d.c b/progs/demos/stex3d.c index 2a35ca161f5..2350532c981 100644 --- a/progs/demos/stex3d.c +++ b/progs/demos/stex3d.c @@ -1,4 +1,4 @@ -/* $Id: stex3d.c,v 1.2 1999/09/17 12:27:01 brianp Exp $ */ +/* $Id: stex3d.c,v 1.4 2000/03/22 19:48:57 brianp Exp $ */ /*----------------------------- * stex3d.c GL example of the mesa 3d-texture extention to simulate procedural @@ -17,6 +17,12 @@ /* * $Log: stex3d.c,v $ + * Revision 1.4 2000/03/22 19:48:57 brianp + * converted from GL_EXT_texture3D to GL 1.2 + * + * Revision 1.3 1999/12/16 08:54:22 brianp + * added a cast to malloc call + * * Revision 1.2 1999/09/17 12:27:01 brianp * silenced some warnings * @@ -53,7 +59,6 @@ void init(void), initNoise(void); float turbulence(float point[3], float lofreq, float hifreq); -int isExtSupported(char *ext); void KeyHandler( unsigned char key, int x, int y ); GLenum parseCmdLine(int argc, char **argv); float noise3(float vec[3]); @@ -121,17 +126,20 @@ void init() /* start the noise function variables */ initNoise(); - /* see if the texture 3d extention is supported */ - if (!isExtSupported("GL_EXT_texture3D")) { - printf("Sorry this GL implementation (%s) does not support 3d texture extentions\n", - (char *)(glGetString(GL_RENDERER))); -/* tkQuit();*/ + /* see if we have OpenGL 1.2 or later, for 3D texturing */ + { + const char *version = (const char *) glGetString(GL_VERSION); + if (strncmp(version, "1.0", 3) == 0 || + strncmp(version, "1.1", 3) == 0) { + printf("Sorry, OpenGL 1.2 or later is required\n"); + exit(1); + } } /* if texture is supported then generate the texture */ create3Dtexture(); - glEnable(GL_TEXTURE_3D_EXT); + glEnable(GL_TEXTURE_3D); /* glBlendFunc(GL_SRC_COLOR, GL_SRC_ALPHA); glEnable(GL_BLEND); @@ -230,7 +238,7 @@ void create3Dtexture() int tmp; printf("creating 3d textures...\n"); - voxels = (unsigned char *) malloc((4*tex_width*tex_height*tex_depth)); + voxels = (unsigned char *) malloc((size_t)(4*tex_width*tex_height*tex_depth)); vp=voxels; for (i=0;i\n"); @@ -432,10 +421,10 @@ void KeyHandler( unsigned char key, int x, int y ) angz-=10; break; case 't': - glEnable(GL_TEXTURE_3D_EXT); + glEnable(GL_TEXTURE_3D); break; case 'T': - glDisable(GL_TEXTURE_3D_EXT); + glDisable(GL_TEXTURE_3D); break; case 's': glShadeModel(GL_SMOOTH);