Skip to content
Kay Steinhoff edited this page Oct 7, 2024 · 3 revisions

bool InitCR (unsigned int width,
      unsigned int height,
      CR_RENDER_BUFFER_TYPE bufferType,
      float fov,
      float nearPlane,
      float farPlane)

Parameters

width

The width of the rendered image(the viewport if you will) as an integer. unsigned to prevent negative values.

heigth

The height of the rendered image(the viewport if you will) as an integer. unsigned to prevent negative values.

bufferType

A enum value from the CR_RENDER_BUFFER_TYPE enum to indicate the bit depth of the render target (24 or 32 bit)

fov

The field of view in degrees. Used to create the projection matrix.

nearPlane

The near plane(the closest point to the camera for a vertex), normally set to a value near or below 0.1.

farPlane

The furthest point a vertex can be from the camera and still be rendered. Normally set to 1000 or above.

Example

#include <stdio.h>
#include <cr.h>

int main(void)
{
    if(!InitCR(800, 600, CR_RGBA, 90, 0.1, 1000))
    {
        printf("Failed to initialize cr!\n");
        return -1;
    }
    return 0;
}

Clone this wiki locally