forked from davidgfnet/opengx
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Store projection matrix as defined by OpenGL specs
In the OpenGL clip space the coordinates in each axis are expected to be in the range [-1, 1]. The GX API differs from this in that the z coordinate range is half of that: [-1, 0]. In order to work with this difference, we were modifying the glFrustum(), glOrtho() functions, as well as some glu functions, so that they'd compute a projection matrix suitable for the GX API. This had a series of disadvantages: - glGetFloatv() would return a projection matrix which is not the one expected by the client; - if the client manually built its own projection matrix, this could either not work at all, or render a scene very different from what was expected; - it forces opengx to reimplement some glu functions This commit fixes these issues by storing the projection matrix according to the OpenGL specifications, and transforms it to the GX clip space using a scale+transfor matrix. Note that the same transformation is applied to the function that we use to compute the near and far planes, which we need for the fog effect.
- Loading branch information
Showing
1 changed file
with
39 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters