c# - Get the bounds of the plane visible at a specific z coordinate -


using opentk, i've created window (800x600) vertical fov of 90°. want make 2d game background image fits on whole screen. want plane @ variable z coordinate rectanglef.

currently code is:

var y = (float)(math.tan(math.pi / 4) * z); return new rectanglef(aspectratio * -y, -y, 2 * aspectratio * y, 2 * y); 

the rectangle calculated little small, effect seems decrease z increasing. hoping find mistake.

i want make 2d game background image fits on whole screen.

then don't bother perspective calculations. switch orthographic projection drawing background, disabling depth writes. switch perspective projection rest.

opengl not scene graph, it's statefull drawing api. make use of fact.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -