OpenGL: How To Scale X,Y So that it is independent of Z?
Hello, I am trying to scale my X,Y values so that they are always between -1 to 1, and adjusting Z will only influence their size but not their position (the same behavior Z has when X,Y both are 0, but instead it can be anywhere on the screen). I don't know how to achieve this scaling though. I can't figure out the ratio of Z to X,Y. Here is a test patch:
Thanks for any help!
perhaps you want to use the @scale attribute ?
hi rob, thanks for the reply. i am familiar with the @scale attribute, but my question is how to account for the difference in X,Y values when Z values change? imagine the screen you view the openGL window on as a 2 dimensional plane, with X values and Y values always being between -1 and 1. If I change the Z value, the location of the objects on this 2 dimensional plane will also change (though their actual x,y values stay the same, the appearance is that with lower Z values, the objects move progressively inward). How can I adjust X and Y according to Z, so that when Z values change, the 'appearance' of X and Y stays the same (though the actual values get shifted according to the difference in Z)? I hope I am making myself clear! :-P Sounds a little complicated, here is a simple patch to illustrate my conundrum:
Hey Sabo...that's exactly what I'm looking for !
Did u find a solution?
Thanx
Peer
jit.gl.render or jit.gl.camera @ortho 1 or 2?