-
Notifications
You must be signed in to change notification settings - Fork 4
2. Setting the transform data
theproadam edited this page Apr 5, 2020
·
3 revisions
To display an image. renderXF needs to know what kind of projection it should use. renderXF supports only orthographic or perspective projection.
renderXF can take custom vertical and horizontal FOV/Size, or it can take a global FOV/Size. For a global FOV/Size renderXF will automatically scale the hFOV/hSize through the render aspect ratio.
//Global FOV/Size
GL.SetMatrixData(FOV, Size);
//Individual FOV/Size
GL.SetMatrixData(hFOV, vFOV, hSize, vSize);
renderXF also allows you to interpolate between two projections. Using the i value from the SetMatrixData()
function, the perspective can be interpolated.
GL.SetMatrixData(FOV, Size, 1f); // Orthographic
GL.SetMatrixData(FOV, Size, 0f); // Perspective
GL.SetMatrixData(FOV, Size, 0.5f);// In between
WARNING: Leaving the i value at near 1 can introduce floating point precision errors. It is recommended to either have it at 0 or 1.
For performance reasons, by default renderXF will automatically handle the camera position and rotation vectors. These vectors can be set via the ForceCameraPosition()
and ForceCameraRotation()
functions.
GL.ForceCameraPosition(new Vector3(0, 0, 0)); //Set camera position
GL.ForceCameraRotation(new Vector3(0, 0, 0)); //Set camera rotation
- Initializing the renderer
- Setting the transform data
- Blitting and clearing the viewport
- Initializing a vertex buffer
- Creating a shader
- Drawing an object
- Screen space shaders
- Blitting bitmaps
- Loading a texture
- Creating a framebuffer
- Displaying a texture