| /* $Id: multiarb.c,v 1.1 1999/08/19 00:55:40 jtg Exp $ */ | |||||
| /* $Id: multiarb.c,v 1.2 1999/10/13 12:02:13 brianp Exp $ */ | |||||
| /* | /* | ||||
| * GL_ARB_multitexture demo | * GL_ARB_multitexture demo | ||||
| /* | /* | ||||
| * $Log: multiarb.c,v $ | * $Log: multiarb.c,v $ | ||||
| * Revision 1.1 1999/08/19 00:55:40 jtg | |||||
| * Initial revision | |||||
| * Revision 1.2 1999/10/13 12:02:13 brianp | |||||
| * use texture objects now | |||||
| * | |||||
| * Revision 1.1.1.1 1999/08/19 00:55:40 jtg | |||||
| * Imported sources | |||||
| * | * | ||||
| * Revision 1.3 1999/03/28 18:20:49 brianp | * Revision 1.3 1999/03/28 18:20:49 brianp | ||||
| * minor clean-up | * minor clean-up | ||||
| static void Init( void ) | static void Init( void ) | ||||
| { | { | ||||
| GLuint texObj[2]; | |||||
| const char *exten = (const char *) glGetString(GL_EXTENSIONS); | const char *exten = (const char *) glGetString(GL_EXTENSIONS); | ||||
| if (!strstr(exten, "GL_ARB_multitexture")) { | if (!strstr(exten, "GL_ARB_multitexture")) { | ||||
| printf("Sorry, GL_ARB_multitexture not supported by this renderer.\n"); | printf("Sorry, GL_ARB_multitexture not supported by this renderer.\n"); | ||||
| exit(1); | exit(1); | ||||
| } | } | ||||
| /* setup texture env 0 */ | |||||
| #ifdef GL_ARB_multitexture | |||||
| glActiveTextureARB(GL_TEXTURE0_ARB); | |||||
| #endif | |||||
| /* allocate two texture objects */ | |||||
| glGenTextures(2, texObj); | |||||
| /* setup texture obj 0 */ | |||||
| glBindTexture(GL_TEXTURE_2D, texObj[0]); | |||||
| #ifdef LINEAR_FILTER | #ifdef LINEAR_FILTER | ||||
| /* linear filtering looks much nicer but is much slower for Mesa */ | /* linear filtering looks much nicer but is much slower for Mesa */ | ||||
| glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); | ||||
| } | } | ||||
| /* setup texture env 1 */ | |||||
| #ifdef GL_ARB_multitexture | |||||
| glActiveTextureARB(GL_TEXTURE1_ARB); | |||||
| #endif | |||||
| /* setup texture obj 1 */ | |||||
| glBindTexture(GL_TEXTURE_2D, texObj[1]); | |||||
| #ifdef LINEAR_FILTER | #ifdef LINEAR_FILTER | ||||
| /* linear filtering looks much nicer but is much slower for Mesa */ | /* linear filtering looks much nicer but is much slower for Mesa */ | ||||
| glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); | ||||
| exit(1); | exit(1); | ||||
| } | } | ||||
| /* now bind the texture objects to the respective texture units */ | |||||
| #ifdef GL_ARB_multitexture | |||||
| glActiveTextureARB(GL_TEXTURE0_ARB); | |||||
| glBindTexture(GL_TEXTURE_2D, texObj[0]); | |||||
| glActiveTextureARB(GL_TEXTURE1_ARB); | |||||
| glBindTexture(GL_TEXTURE_2D, texObj[1]); | |||||
| #endif | |||||
| glShadeModel(GL_FLAT); | glShadeModel(GL_FLAT); | ||||
| glClearColor(0.3, 0.3, 0.4, 1.0); | glClearColor(0.3, 0.3, 0.4, 1.0); | ||||