glBindTexture(GL_TEXTURE_RECTANGLE_ARB, ...) throws GL errors

Posts: 86
Joined: 2005.01
Post: #1
I've been trying to get my FBO render-to-texture support working with non-power-of-2 textures.

Apple's site seems to recommend the GL_ARB_texture_rectangle extension, which I have on my ATI x1600 Mobility (GL version 1.5, OSX 10.4.7).

However, after I create the texture and attempt to bind it using GL_TEXTURE_RECTANGLE_ARB, GL files a GL_INVALID_OPERATION error, which the man page for glBindTexture says should only happen when the dimensionality is wrong (texture hasn't actually been "allocated" with glTexImage2D yet, but all the examples I see do what I'm doing) or it's within a glBegin/glEnd block (it isn't).

Has anyone else had this problem, or is it going to be another one of the unsolved mysteries with ATI's terrible drivers?

This is pretty much out of the gate after I do glGenTextures and set up my FBO:
testError("Enable tex rectangle");
testError("Disable tex2d");
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, *texture);
testError("Bind texture rectangle [TexID:" + Propane::toString(*texture) + "]"); // Stops here (assertion)

testError("texture parameters");
glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA, t_width, t_height, 0, GL_RGBA, GL_INT, NULL);
testError("non-pow2 build texture");
My testError function is just a macro to check the GL error by asserting it's GL_NO_ERROR, and if not printing out the human readable debug text so I can figure out what the hell is going on.

The texture does create properly (*texture = 63), but I've got no idea why the binding is failing or how to go about trying to resolve it, since this appears to be undocumented.

Newest game: Glow, a sci-fi RPG with lots of zombie bashing. Get it: OS X
Quote this message in a reply
Posts: 86
Joined: 2005.01
Post: #2
Odd -- I had some code handling the parameters for GL_TEXTURE_2D in my execution path, and I guess that must have done it. Moving that code out of my execution path fixed the problem for now.

For future reference, here is the involved code:
glBindTexture(GL_TEXTURE_2D, *texture); // Problem persists if I later bind GL_TEXTURE_2D to 0
testError("Bind texture");
/* The source of the problem must lie here somewhere; GL_TEXTURE_RECTANGLE_ARB
"should" have a separate set of texture parameters for itself but apparently not. Some
sort of stuck/corrupt state caused it to get confused and throw errors.

This is probably because I set mag/min filter for texture_rectangle *after* attempting to bind that
testError("Texture parameter");
testError("Texture parameter");

Newest game: Glow, a sci-fi RPG with lots of zombie bashing. Get it: OS X
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  GL_TEXTURE_RECTANGLE_ARB not working...? djork 8 7,066 Aug 17, 2006 02:34 PM
Last Post: OneSadCookie
  glBindTexture dave05 3 3,293 Jun 13, 2005 09:24 PM
Last Post: kelvin
  glBindTexture with ALPHA sux on NVIDIA Cards !? hgore69 1 3,031 Mar 12, 2005 01:35 PM
Last Post: OneSadCookie