GL_ARB_texture_rectangle causing GL_INVALID_ENUM?

I’m trying to write a very simply GLUT program for OSX which just shows an image in a window. (It does a bit more than that, but that’s the essentials.)

Naturally I’d rather not constraint the image to power-of-two size, or resample it myself, so I’m trying to use GL_ARB_texture_rectangle as my target.

The code:

glBindTexture reports error GL_INVALID_ENUM.
Clearly the extension is supported, so what’s the problem? I did call glewInit() previously…

This is on OSX using XCode, incidentally.

Unrelated question----is GLUT on OSX known to be broken? Because my windows keep having garbage from elsewhere on the screen showing up in them.

so I’m trying to use GL_ARB_texture_rectangle as my target.
“GL_ARB_texture_rectangle” is a preprocessor token that’s #defined to indicate the presence of the corresponding extension interface at compile time. It is not a valid parameter to BindTexture; the target you want to use is “GL_TEXTURE_RECTANGLE_ARB”.

Gah. You know, I was suspicious of the lowercase letters.

There’s still the matter of my GLUT window being contaminated by random garbage, although I can see the majority of the image behind it well enough. I know it’s not a texture error, because the same garbage shows up on top of the color gradient when I disable textures.

More importantly, glTexSubImage2D is reporting GL_INVALID_VALUE on every call after the first when used as such…

//(setupTextures function which is called every time a certain event happens)

if (firsttime)
{
glTexImage2D(texTarget, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
firsttime = false;
}

glTexSubImage2D(texTarget,0,0,0,width,height,GL_RGB,GL_UNSIGNED_BYTE,texim);

no glut is not broken on osx. try to run some other demo programs to verify the problem is with glut.