summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>1999-10-13 12:02:13 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>1999-10-13 12:02:13 +0000
commit1a3b8ffe01a3844d990627db3d5f2f04006f17eb (patch)
treed59b21aa9a91a830a3d610fe2f150ebc5a3b74f9
parentf80d0b2f613fc5c5dfdf95ade12ddf5968f94073 (diff)
use texture objects now
-rw-r--r--progs/demos/multiarb.c35
1 files changed, 24 insertions, 11 deletions
diff --git a/progs/demos/multiarb.c b/progs/demos/multiarb.c
index 68419cd7ea..267fbe95e3 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);