PDA

View Full Version : glIsEnabled



Vlasko
03-10-2003, 11:36 AM
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 ?

Miguel_dup1
03-10-2003, 01:00 PM
Are you binding the texture?

glBind( ... )
glEnable( .... )


Originally posted by Vlasko:
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 ?

Vlasko
03-11-2003, 06:23 AM
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_FILTE R,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTE R,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;
}

Vlasko
03-11-2003, 10:21 AM
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 ?

yaro_dup1
03-11-2003, 10:56 AM
Hi,

Try adding glEnable(GL_TEXTURE_2D) BEFORE
function LoadTextures.

yaro

Vlasko
03-11-2003, 11:50 AM
Found it! after hour or so :-) i realized that all the init stuff comes AFTER creating window (oh stupid me) thanks anyway