OpenGL Library for Delphi,
maintained by Eric Grange,
based on Mike Lischke's GLScene.

 

Tips - Using OnCustomPerspective to set up a resolution independant view


By default, GLScene uses glFrustum to set up the perspective view, but the amount of the scene visible depends on how large the viewer is.
This may not be the disired behaviour, depending on your application.

If you use this method, the appearance of your scene is no longer resolution dependent.
For example using 640x480 or 1280x1024 makes no difference.
Because they have the same aspect ratio, the scene will look almost identical.
It will still be higher quality with the higher resolution, with less jaggys etc.

Here's how to do it..

Set your camera's CameraStyle property to csCustom.

In the OnCustomPerspective event of your camera, use this line of code..

uses opengl1x;

procedure TForm1.CamCustomPerspective(const viewport: TRectangle; width,
    height, DPI: Integer; var viewPortRadius: Single);
begin
    gluPerspective(cam.FocalLength, width / height, cam.NearPlaneBias, cam.DepthOfView);
end;
Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by Wikka Wakka Wiki 1.1.6.2
Page was generated in 0.0927 seconds