glIsEnabled

I have made the texturing tutorial from nehe but the texture won’t show on quad so i have tested GL_TEXTURE_2D with glIsEnabled()

glEnable(GL_TEXTURE_2D); //no other command between //
if(glIsenabled(GL_TEXTURE_2D)==GL_FALSE)printf(“Error”);

I always get the Error message and also the same with GL_DEPTH_TEST
Have I something wrong linked(no error shown)? or something else ?

Are you binding the texture?

glBind( … )
glEnable( … )

Originally posted by Vlasko:
[b]I have made the texturing tutorial from nehe but the texture won’t show on quad so i have tested GL_TEXTURE_2D with glIsEnabled()

glEnable(GL_TEXTURE_2D); //no other command between //
if(glIsenabled(GL_TEXTURE_2D)==GL_FALSE)printf(“Error”);

I always get the Error message and also the same with GL_DEPTH_TEST
Have I something wrong linked(no error shown)? or something else ? [/b]

Yes first I load texture bind it and then enable it

bool LoadTextures()
{
AUX_RGBImageRec *TextureImage[1];
if((file=fopen(“texture.bmp”,“r”))==NULL) return false;
else fclose(file);
TextureImage[0]=auxDIBImageLoad(“texture.bmp”);
glGenTextures(1,&texture[0]);
glBindTexture(GL_TEXTURE_2D,texture[0]);
glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureImage[0]->sizeX, TextureImage[0]->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[0]->data);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
return true;

}

init()
{
if(!LoadTextures())
exit(1); //this is ok
glEnable(GL_TEXTURE_2D);
if(glIsEnabled(GL_TEXTURE_2D)==GL_FALSE) {printf(“Error!”);exit(1);} //something wrong here //
glShadeModel(GL_SMOOTH);
glClearColor(0.0f,0.0f,0.0f,0.5f);
glClearDepth(1.0f);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
return true;
}

after glTexImage2D
I’ve added error checking routine

GLenum err = glGetError();
if (err)
{
printf("%i",err);
exit(1);
}
it produces error number 1282 (or with gluErrorString() - invalid operation(i’ve got a localized string on the screen so its just translation :-)) can anybody help ?

Hi,

Try adding glEnable(GL_TEXTURE_2D) BEFORE
function LoadTextures.

yaro

Found it! after hour or so :slight_smile: i realized that all the init stuff comes AFTER creating window (oh stupid me) thanks anyway