mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-03 01:18:06 +02:00
use texture objects now
This commit is contained in:
parent
f80d0b2f61
commit
1a3b8ffe01
1 changed files with 24 additions and 11 deletions
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue