PDA

View Full Version : Question regarding glIsEnabled() constants



awhig
07-06-2009, 01:11 PM
I am doing following


bresult = glIsEnabled(GL_TEXTURE_RECTANGLE_ARB);
err = glGetError();
if(err != GL_NO_ERROR){
MessageBox(NULL, "setTexture: Error in checking enabled rect texture", "Tex Error",MB_ICONERROR);
exit(1);
}
if(!bresult){
err = GL_NO_ERROR;
glEnable(GL_TEXTURE_RECTANGLE_ARB);
err = glGetError();
if(err != GL_NO_ERROR){
MessageBox(NULL, "setTexture: Error in enabling rect texture", "TexParam Error",MB_ICONERROR);
exit(1);
}


Now, after enabling GL_TEXTURE_RECTANGLE_ARB, for the first time, the variable 'bresult' shows me value '1' or 'true'.

But when I come to this piece of code again (in a loop) , it throws me 0, after I do this:
I activate GL_TEXTURE1

glActiveTexture(GL_TEXTURE1)

I am shown an error of GL_INVALID_ENUM.
If this is the case then why was this error not thrown for first time?

Anyware, in my code I am not disabling this target i.e GL_TEXTURE_RECTANGLE_ARB.

To verify the reason, I referred to the official specification of glIsEnabled()
ref: http://www.opengl.org/sdk/docs/man/xhtml/glIsEnabled.xml

I found no mention of this target type in the list of supported constants.
I am using OpenGL 3.0 ,using glew version 1.5.1.

Then how to check whether GL_TEXTURE_RECTANGLE_ARB is enabled?Or is there any new version of glIsEnabled() that I may be missing?


P.S: This piece of code is called in a local function.The RECTANLGE target type was initially enabled outside the function. i.e globally in a constructor.

But I get above observation in the local function for the second time and onwards.

I do not think that there is any connection of local or global variable here, in regards to enabling the target outside a local function and then checking it inside local function.

Correct me if I am wrong.


Thank you.