Forums > Jitter

OpenGL: How To Scale X,Y So that it is independent of Z?

Jan 06 2013 | 2:19 pm

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:

-- Pasted Max Patch, click to expand. --

Thanks for any help!

Jan 07 2013 | 10:32 pm

perhaps you want to use the @scale attribute ?

Jan 08 2013 | 2:53 pm

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:

-- Pasted Max Patch, click to expand. --

Oct 06 2015 | 7:26 am

Hey Sabo…that’s exactly what I’m looking for !
Did u find a solution?


Oct 06 2015 | 9:57 am or @ortho 1 or 2?

Viewing 5 posts - 1 through 5 (of 5 total)

Forums > Jitter