Gl_texture_rectangle_ext

nabobnick
Unregistered
 
Post: #1
OK I had some code that would load in a texture and display it on a full screen quad, it was based off of the Apple Texture Range example and it would display correctly. Next I modified my code to load in a 3d object (including normals, and texture coordinates) and map this texture on to it. At this point no matter what I do was I able to get the texture to show up on the object correctly, instead of a texture I get what looks like might be a single shade of color (brownish green) which seems to be parts of the texture being mapped. Then on a whim I switched all occurences of GL_TEXTURE_RECTANGLE_EXT with GL_TEXTURE_2D and everything started working (well mostly, the texture coords may be a bit off) and I can now see the texture mapped to the object.

1.) Is there anything special you have to do when using GL_TEXTURE_RECTANGLE_EXT to get textures to show up?

2.) Why when I could see the texture mapped to a flat quad would it suddenly stop working when I begin to map it to multiple polygons?

If hardware matters I have a 17" iMac with a GeForce 4MX 64Mb.
Quote this message in a reply
Moderator
Posts: 1,560
Joined: 2003.10
Post: #2
I remember hearing that texture coordinates for GL_TEXTURE_RECTANGLE_EXT are specified in pixels, as opposed to the homogenous coordinates for GL_TEXTURE_2D. I've never used GL_TEXTURE_RECTANGLE_EXT myself, though, so bear in mind this isn't first-hand information.

Alex Diener
Quote this message in a reply
Sage
Posts: 1,232
Joined: 2002.10
Post: #3
RTFM:

Quote:How are texture coordinates addressed for rectangular textures?

Texture coordinates are addressed without being normalized from
[0..1], instead [0..w] and [0..h] are used, where w and h are width
and height of the texture respectively.

Seriously, RTFM. There is a lot of particular information you have to know before trying to use OpenGL, especially extensions.
Quote this message in a reply
nabobnick
Unregistered
 
Post: #4
Was using the Redbook for a guide although it does not mention GL_TEXTURE_RECTANGLE_EXT that I saw. Is there a better place for a noob to look up this kind of stuff so I won't have to bother you?

Thanks for the answer though that clears up why it looked like I was getting only about one pixel worth of the texture, I guess I need to multiply my texture coords by the width and height to get them to map correctly. Now that I think about it the Apple Texture Range example uses the width and height of the texture in the glTexCoord calls, I missed this because I assumed it was some state that I didn't enable or something.
Quote this message in a reply
Sage
Posts: 1,232
Joined: 2002.10
Post: #5
You can multiply in either glTexCoord, or in the texture matrix.

For reference material, this book might be good.

Or the official online registry.

And there's my page which lists what extensions are available on each GPU under a few versions of OS X, as well as linking to the sgi, PC, and Apple registries.

And don't forget the official specs.
Quote this message in a reply
nabobnick
Unregistered
 
Post: #6
Thanks those will help alot. I always prefer to look things up but sometimes your not sure where to look.
Quote this message in a reply
Member
Posts: 144
Joined: 2004.07
Post: #7
My personal favorite way to look up information on extensions (besides google):

Delphi's OpenGL Hardware Registry

Click the name to see what cards support the extension, and click the spec link to view the spec for the extension. I use it all the time.

Derek
Quote this message in a reply
Sage
Posts: 1,232
Joined: 2002.10
Post: #8
Yeah, that's the PC registry I link to. My page is an attempt to be Delphi, for Macs.
Quote this message in a reply
Member
Posts: 144
Joined: 2004.07
Post: #9
arekkusu Wrote:Yeah, that's the PC registry I link to. My page is an attempt to be Delphi, for Macs.

Ah, didn't notice that. Cool.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  cant get GL_TEXTURE_RECTANGLE_EXT to work nuero 9 3,649 Jul 6, 2006 02:41 PM
Last Post: OneSadCookie