Non-square textures in OS X OpenGL
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?
Does anyone know if this is somehow broken in Apple's implementation of OpenGL?
it's always worked fine for me.
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?
I have code that's working for square images. But if I use a non-square image, the texture is blank.
you have a bug.
oh that onesadcookie.
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.)
* 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.)
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....]
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.
You can also set the base and max mip levels if you don't want to define every level.
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?
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.
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.
that is only the case for EXT_texture_rectangle, which the OP specifically stated he's avoiding!
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| [SOLVED]OpenGL edges of textures | mk12 | 2 | 3,612 |
Sep 2, 2010 08:07 PM Last Post: mk12 |
|
| Want good color interpolation for my square | Najdorf | 2 | 3,366 |
Nov 22, 2009 10:11 PM Last Post: Najdorf |
|
| OpenGL Image Textures | mikey | 52 | 19,913 |
Jun 30, 2009 10:42 AM Last Post: AnotherJake |
|
| Dealing with inverted textures in OpenGL | johncmurphy | 7 | 5,844 |
Jun 15, 2009 08:11 AM Last Post: Skorche |
|
| Trying to make a square... there's a triangle! | TimMcD | 4 | 3,366 |
Jun 2, 2009 03:41 PM Last Post: AnotherJake |
|

