screenScale and orthographic projections

Java3D has a screenScale variable in View that is useful for orthographic projections. Adding this compatibility feature would be very simple, requiring only two changes:

  1. Implement the setScreenScale method in View.

  2. Change the call to orthoMesa in calculatePerspective() to:
    float a = (float)canvas.get3DPeer().getWidth()/(float)canvas.get3DPeer().getHeight();
    float ss = 0.5fscreenScale;
    projection.orthoMesa(-a
    ss, a*ss, -ss, ss, -backClipDistance, backClipDistance);

Could someone look into this? It would be very helpful! :smiley:

Oh yeah, screenScale should default to 1.0f for backwards compatibility.

are you sure this is backward compatable?

For a screen size of 640x480 with screenScale of 1.0f, I get different values using the new code to the old code. For backward compatability don’t we need the new code to generate the same values with a screenScale of 1.0f?

Will.

Yes! ;D So the call should be:

projection.orthoMesa(-screenScale, screenScale, -screenScalecanvasHalfHeight, screenScalecanvasHalfHeight, -backClipDistance, backClipDistance);

I can adapt my code to work with that!

backward compatable patch committed.

Will.

Thanks!