Function
Set or retrieve the resolution of a Camera.
Syntax
#include <dx/dx.h>
Camera DXSetResolution(Camera c, int hres, double pix_aspect)
Camera DXGetCameraResolution(Camera c, int Xresolution, int Yresolution)
Functional Details
A Camera defines the position orientation of the viewer, the volume of interest of the object being viewed, and the size of the image to contain the resulting view.
The horizontal size of the image containing the resulting view is defined by the resolution in pixels; the vertical size is determined by the resolution * aspect. This is camera aspect, not pix_aspect; see DXSetPerspective and DXSetOrthographic. The same aspect ratio is used for both the size of the image and the volume of the interest to prevent the objects from being stretched in one of the dimensions.
If the display pixels are not square, pix_aspect can be used to compensate. Pixels are not square when the ratio of the number of pixels in the x and y dimensions does not equal the width:height ratio of the screen.
pix_aspect prevents objects from appearing stretched in one dimension (e.g. preventing a circle from becoming an ellipse on a screen with rectangular pixels). Pixels are assumed to be pix_aspect times as tall as they are wide. Most screens have square pixels and it is rarely necessary to set pix_aspect to a value other than 1.
DXSetResolution, for camera c, sets the horizontal resolution to hres and the pixel aspect ratio to pix_aspect.
DXGetCameraResolution, for camera c, if Xresolution is not NULL, returns the resolution in *Xresolution. If Yresolution is not NULL, returns the resolution * aspect in *Yresolution. Again, this is camera aspect.
Return Value
DXSetResolution returns the Camera or returns NULL and an error code.
DXGetCameraResolution returns the parameters or returns NULL and sets an error code.
See Also
DXGetCameraMatrix, DXGetCameraRotation, DXGetCameraMatrixWithFuzz, DXNewCamera, DXRender, DXSetOrthographic, DXGetOrthographic, DXSetPerspective, DXGetPerspective, DXSetView, DXGetView