The problem is this, I have input from a camera in 240×160 res, I place it in a 256×256 texture.
I then map it to a quad [0..240/256] on the U, and [0..160/256] on the V. Works fine, but the problem is I am rendering to a buffer…
The buffer is the correct ratio because I don’t want to do more pixels than is nessasary. Then I come to apply a different effect and render to the next buffer. But by this point I have to use the range [0..1] on both U and V and so my aspect ratio has been lost.
The problem is that my pixel shader effects can rely on aspect ratio, for example, a water ripple needs to calculate distance from the centre.
I can fix the problem in the shaders, but ideally at the second (or more) pass I want to set the UV range so that aspect ratio is preseved.
Can I do this?
Texture coordinates are always from [0,1] in OpenGL ES. You’ll have to either pass in the aspect ratio as a uniform, or create your texture with the same aspect ratio to begin with.