disable glActiveTextureARB(GL_TEXTUREx_ARB)

disable glActiveTextureARB(GL_TEXTUREx_ARB)

Post by sew » Fri, 22 Mar 2002 06:54:34



hello

I have a little problem. I'd like to disable GL_TEXTUREx_ARB with this piece
of code
    glActiveTextureARB(GL_TEXTUREx_ARB);
    glDisable(GL_TEXTURE_2D);

It seems working only with GL_TEXTURE0_ARB
Do you have any idea on which reasons could cause this.

thank you.

You can see a sample source code of this error here :

#include <windows.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>
#include <GL/glaux.h>
#include <stdio.h>

#include <GL/glati.h>
#include <GL/wglati.h>

#pragma comment(lib,"glaux.lib")

unsigned char imagedata[12];
GLuint TextureID;

PFNGLCLIENTACTIVETEXTUREARBPROC    glClientActiveTextureARB = NULL;
PFNGLACTIVETEXTUREARBPROC          glActiveTextureARB = NULL;
PFNGLMULTITEXCOORD3FVARBPROC       glMultiTexCoord3fvARB = NULL;
PFNGLMULTITEXCOORD3FARBPROC        glMultiTexCoord3fARB = NULL;
PFNGLMULTITEXCOORD2FVARBPROC       glMultiTexCoord2fvARB = NULL;
PFNGLMULTITEXCOORD2FARBPROC        glMultiTexCoord2fARB = NULL;
PFNGLMULTITEXCOORD1FARBPROC        glMultiTexCoord1fARB = NULL;

void draw(void)
{
 glClear(GL_COLOR_BUFFER_BIT);
 glLoadIdentity();
 glTranslatef(-0.5,-0.5,0);

 //IF I USE THIS ... TEXTURE APPEARANCE CHANGE. EXCEPT IF I USE
GL_TEXTURE0_ARB
 glActiveTextureARB(GL_TEXTURE0_ARB);
  glEnable(GL_TEXTURE_2D);
 glActiveTextureARB(GL_TEXTURE0_ARB);
  glDisable(GL_TEXTURE_2D);

 glEnable(GL_TEXTURE_2D);
 glBindTexture(GL_TEXTURE_2D, TextureID);

 glBegin(GL_QUADS);
  glTexCoord2f(1.0f, 1.0f);glVertex2i(1, 1);
  glTexCoord2f(0.0f, 1.0f);glVertex2i(0, 1);
  glTexCoord2f(0.0f, 0.0f);glVertex2i(0, 0);
  glTexCoord2f(1.0f, 0.0f);glVertex2i(1, 0);
 glEnd();

 glFlush();

Quote:}

int InitExtension()
{
   if (glutExtensionSupported("GL_ARB_multitexture"))
   {
      glClientActiveTextureARB = (PFNGLCLIENTACTIVETEXTUREARBPROC)
wglGetProcAddress("glClientActiveTextureARB");
      glActiveTextureARB = (PFNGLACTIVETEXTUREARBPROC)
wglGetProcAddress("glActiveTextureARB");
      glMultiTexCoord3fvARB = (PFNGLMULTITEXCOORD3FVARBPROC)
wglGetProcAddress("glMultiTexCoord3fvARB");
      glMultiTexCoord3fARB = (PFNGLMULTITEXCOORD3FARBPROC)
wglGetProcAddress("glMultiTexCoord3fARB");
      glMultiTexCoord2fARB = (PFNGLMULTITEXCOORD2FARBPROC)
wglGetProcAddress("glMultiTexCoord2fARB");
      glMultiTexCoord2fvARB = (PFNGLMULTITEXCOORD2FVARBPROC)
wglGetProcAddress("glMultiTexCoord2fvARB");
      glMultiTexCoord1fARB = (PFNGLMULTITEXCOORD1FARBPROC)
wglGetProcAddress("glMultiTexCoord1fARB");
      if (glClientActiveTextureARB == NULL)
      {
         printf("Can't init glClientActiveTextureARB");
         return(FALSE);
      }
      if (glActiveTextureARB == NULL)
      {
         printf ("Can't init glActiveTextureARB");
         return(FALSE);
      }
      if (glMultiTexCoord3fvARB == NULL)
      {
         printf ("Can't init glMultiTexCoord3fvARB");
         return(FALSE);
      }
      if (glMultiTexCoord3fARB == NULL)
      {
         printf ("Can't init glMultiTexCoord3fARB");
         return(FALSE);
      }
      if (glMultiTexCoord2fARB == NULL)
      {
         printf ("Can't init glMultiTexCoord2fARB");
         return(FALSE);
      }
      if (glMultiTexCoord2fvARB == NULL)
      {
         printf ("Can't init glMultiTexCoord2fvARB");
         return(FALSE);
      }
      if (glMultiTexCoord1fARB == NULL)
      {
         printf ("Can't init glMultiTexCoord1fARB");
         return(FALSE);
      }
   }
   else
   {
      printf("No multitexture support!");
      return(FALSE);
   }
   return(TRUE);

Quote:}

void CreateTexture()
{
 glGenTextures(1, &TextureID);

 imagedata[0] = 50;
 imagedata[1] = 100;
 imagedata[2] = 200;
 imagedata[3] = 255;
 imagedata[4] = 255;
 imagedata[5] = 0;
 imagedata[6] = 200;
 imagedata[7] = 100;
 imagedata[8] = 255;
 imagedata[9] = 50;
 imagedata[10] = 255;
 imagedata[11] = 150;

 glBindTexture(GL_TEXTURE_2D, TextureID);
 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 2, 2, 0, GL_RGB, GL_UNSIGNED_BYTE,
imagedata);

 glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
 glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);

Quote:}

int main(int argc, char **argv)
{
 glutInit(&argc, argv);
    glutInitWindowSize(400,400);
    glutInitDisplayMode(GLUT_RGB);
    glutCreateWindow("PB");
    glutDisplayFunc(draw);

 if(!InitExtension())
  return 1;

 CreateTexture();

    glutMainLoop();

 return 0;

Quote:}