From 1a3b8ffe01a3844d990627db3d5f2f04006f17eb Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 13 Oct 1999 12:02:13 +0000 Subject: [PATCH] use texture objects now --- progs/demos/multiarb.c | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/progs/demos/multiarb.c b/progs/demos/multiarb.c index 68419cd7ea4..267fbe95e30 100644 --- a/progs/demos/multiarb.c +++ b/progs/demos/multiarb.c @@ -1,4 +1,4 @@ -/* $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 @@ -7,8 +7,11 @@ /* * $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 * minor clean-up @@ -223,16 +226,19 @@ static void SpecialKey( int key, int x, int y ) static void Init( void ) { + GLuint texObj[2]; + const char *exten = (const char *) glGetString(GL_EXTENSIONS); if (!strstr(exten, "GL_ARB_multitexture")) { printf("Sorry, GL_ARB_multitexture not supported by this renderer.\n"); 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 /* linear filtering looks much nicer but is much slower for Mesa */ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); @@ -252,10 +258,8 @@ static void Init( void ) } - /* 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 /* linear filtering looks much nicer but is much slower for Mesa */ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); @@ -272,6 +276,15 @@ static void Init( void ) 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); glClearColor(0.3, 0.3, 0.4, 1.0); -- 2.30.2