When I do this my data is skewed 45 degrees, as if it is off by one pixel each row. Oddly enough, the same thing happens when I try a 513x513 texture. Any thoughts?
Try setting the second parameter of glPixelStorei() to 1 (513 - 512)? I don’t normally use glPixelStore*() often (I think that only once when initializing texturing), but I think that’s the cause, judging how stride values are given often in other functions. Also it would make sense the 45 degree skewing.
If that doesn’t work, try 512. Yeah, trial and error, like I said, I only use it for texturing and there I only need to give 1 as value But you better try out all possible values for this.
These days you should just be able to use a non-pow2 texture map with any modern hardware.
As arekkusu commented, you’ll need to either need to set the GL_UNPACK_ALIGNMENT to 2 (or you could just be crazy and go all the way to 1 for convenience).
Anyways, stupid question… wouldn’t this leave two borders away? I mean, if the value at 512 and the one at 513 are completely different, you’ll see the value at 512 and you can’t know what’s meant to be show at 513. In order to fix this, you would have to do some kind of average… which will result in a 512x512 texture that will kill out any issue of this kind
Just an opinion, a 513x513 texture could do too, just it isn’t power-of-two and there are still several pre-GL2 cards (specially Intel cards). I mean, once I found a card with GL 1.3 and the computer wasn’t too old…