Non-square textures in OS X OpenGL

tigakub
Unregistered
 
Post: #1
I know the red book and several other sources say that non-square power-of-2 textures are permissible. But I can't seem to get it to work. Is there something I have to enable? I don't want to use GL_TEXTURE_RECTANGLE_EXT because I am using mipmaps.

Does anyone know if this is somehow broken in Apple's implementation of OpenGL?
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #2
it's always worked fine for me.
Quote this message in a reply
Sage
Posts: 1,232
Joined: 2002.10
Post: #3
tigakub Wrote:But I can't seem to get it to work.
You'll have to clarify "can't get it to work". You get all white? Pink? Zebra stripes?
Quote this message in a reply
tigakub
Unregistered
 
Post: #4
I have code that's working for square images. But if I use a non-square image, the texture is blank.
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #5
you have a bug.
Quote this message in a reply
Member
Posts: 129
Joined: 2005.02
Post: #6
oh that onesadcookie. LOL
Quote this message in a reply
Sage
Posts: 1,232
Joined: 2002.10
Post: #7
OK, round 2: your texture is blank. Something about the texture is invalid. What is it?
* what does glGetError() say, after every single gl function?
* what are the texture dimensions? format? type? shoe size?
* how are you loading the texture data? Are you sure the client-side texels are OK?
* are you sure you've got the mipmap state set right, and a valid mipmap for every level (remember, every level must have POT dimensions.)
Quote this message in a reply
Moderator
Posts: 771
Joined: 2003.04
Post: #8
tigakub Wrote:I have code that's working for square images. But if I use a non-square image, the texture is blank.

Size?

[filling the minimum 10 chars post....]
Quote this message in a reply
tigakub
Unregistered
 
Post: #9
arekkusu Wrote:* are you sure you've got the mipmap state set right, and a valid mipmap for every level (remember, every level must have POT dimensions.)

You guys are great! That was it. I am generating the mipmaps by right-shifting width and height variables and stopping when either reaches 0. That means that I'm not generating the final 1 pixel high mipmap.

Thanks for your help.
Quote this message in a reply
Sage
Posts: 1,232
Joined: 2002.10
Post: #10
You can also set the base and max mip levels if you don't want to define every level.
Quote this message in a reply
tigakub
Unregistered
 
Post: #11
cool! thanks, I did not know that and will definitely look into it

Grin
Quote this message in a reply
Puzzler183
Unregistered
 
Post: #12
Also, did you set the x and y sizes differently now that you are using a rectangular image? And are you taking into account pitch in the actual image data?
Quote this message in a reply
tigakub
Unregistered
 
Post: #13
Hmmm. Not really sure why I need to be concerned about that unless you mean whether I'm scaling the texel coordinates to compensate for the non-square aspect ratio -- yes I'm doing that.
Quote this message in a reply
Member
Posts: 78
Joined: 2002.06
Post: #14
I suspect your problem is that rectangular texture coordinates are not scaled to (1,1) but are left as the actual image size (eg. (100, 200)). Your texture is probably "blank" because your are only using one pixel of the whole texture. You can either modify the texture matrix or just multiply them yourself which is simpler.
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #15
that is only the case for EXT_texture_rectangle, which the OP specifically stated he's avoiding!
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  [SOLVED]OpenGL edges of textures mk12 2 4,539 Sep 2, 2010 08:07 PM
Last Post: mk12
  Want good color interpolation for my square Najdorf 2 4,071 Nov 22, 2009 10:11 PM
Last Post: Najdorf
  OpenGL Image Textures mikey 52 25,664 Jun 30, 2009 10:42 AM
Last Post: AnotherJake
  Dealing with inverted textures in OpenGL johncmurphy 7 7,187 Jun 15, 2009 08:11 AM
Last Post: Skorche
  Trying to make a square... there's a triangle! TimMcD 4 3,916 Jun 2, 2009 03:41 PM
Last Post: AnotherJake