PDA

View Full Version : GL_TEXTURE_RECTANGLE_ARB not working...?


djork
2006.08.16, 04:32 PM
I am having trouble with using GL_TEXTURE_RECTANGLE_ARB as a target for textures. I have no problem loading and displaying a texture using GL_TEXTURE_2D. When I replace all of my 2D's with RECTANGLE_ARB's I get no texturing at all.

I am using these constants in all of the relevant texturing calls, such as glEnable(), glGenTextures, glBindTexture, glTexImage2D, etc...

Shouldn't any modern GPU be able to handle this? glGetError returns no error codes when loading a texture with the rectangle extension. What gives?

TomorrowPlusX
2006.08.16, 04:48 PM
Can you post some code?

Also, and I'm just throwing this out here, are you using pixel coordinates for glTexCoord? GL_RECTANGLE_TEXTURE requires you to use pixel coordinates instead of the [0->1] coords you use for GL_TEXTURE_2D.

djork
2006.08.16, 04:54 PM
Can you post some code?

Also, and I'm just throwing this out here, are you using pixel coordinates for glTexCoord? GL_RECTANGLE_TEXTURE requires you to use pixel coordinates instead of the [0->1] coords you use for GL_TEXTURE_2D.

:mad: :mad: :mad:

That's it! I had no idea. This didn't really jump out at me in any documentation...

Thanks!

arekkusu
2006.08.16, 05:35 PM
It is very clearly stated in the spec (http://www.opengl.org/registry/specs/ARB/texture_rectangle.txt). See the overview and issue 11.

We also specifically point this out in the OpenGL Programming Guide for Mac OS X (http://developer.apple.com/documentation/GraphicsImaging/Conceptual/OpenGL-MacProgGuide/opengl_texturedata/chapter_10_section_4.html#//apple_ref/doc/uid/TP40001987-CH407-SW3).

djork
2006.08.17, 10:32 AM
I'll start reading the specs more often then :)

TomorrowPlusX
2006.08.17, 11:48 AM
Sometimes it's hard to know which spec to read; not to mention grokking it and keeping it in your head. I keep a number of specs on my hard disk for reference, but half the time I have aproblem, arekkusu drops a spec to clarify.

Useful, he is. With his specs.

arekkusu
2006.08.17, 01:29 PM
I believe very strongly in reading the documentation.

OpenGL (and programming in general) is really fantastically complex. It isn't like a toaster oven where you can just poke a button and guess what will happen. There are millions of bits flying around; you have no chance of "guessing" how they work together. You must read the documentation.

Of course, OpenGL's documentation is very dense and technical, which is hard for some people. That's why there are many books (http://www.amazon.com/s/ref=nb_ss_b/104-3384928-6403142?url=search-alias%3Dstripbooks&field-keywords=opengl&Go.x=0&Go.y=0&Go=Go) to make it easier. But the specifications are always there as the real reference.

TomorrowPlusX
2006.08.17, 05:30 PM
Of course, OpenGL's documentation is very dense and technical, which is hard for some people. That's why there are many books (http://www.amazon.com/s/ref=nb_ss_b/104-3384928-6403142?url=search-alias%3Dstripbooks&field-keywords=opengl&Go.x=0&Go.y=0&Go=Go) to make it easier. But the specifications are always there as the real reference.

I can't agree enough. I've got the Red Book ( mine is so out of date as to be silly, however ), the Orange Book, the OpenGL SuperBible, and some windows-centric book about game programming in OpenGL which has good material, but worthless boilerplate since it's all win32.

What I'd like would be to download all the specs from the oss.sgi site to my hard disk, tag them all with "OpenGL" so that Spotlight could index them. The only thing stopping me, I suppose, is laziness.

OneSadCookie
2006.08.17, 06:34 PM
You really don't need a version of the red book that deals with OpenGL newer than 1.1 -- that's essentially what you'll be using, anyway. All the useful extras on top of that you'll be using as extensions, and those are documented separately.