Initialize the engine

1. Basic Initialization

First of all, you have to load the engine, so create a new object obj_controller and set the persistent flag, to prevent destruction on room changes.

Create Event

glr_init(1);
this function will initialize glare engine, and MUST be called before everything.
The first argument of the function is the rendering quality
there are 2 optional parameters (quality, width, height) that define the size of the view affected by Glare.

Draw Begin Event

glr_render();
This function renders all lights and shadows on the main glare surface and should be used in the draw begin event.

Draw Event

glr_draw(x, y)
This function, draws the main glare surface on the screen

2. Using the Additive Rendering

This method requires the application_surface to be active.
Remember to remove glr_draw from the Draw Event and use glr_draw_gamma(application_surface) in the Post Draw Event
With this method the intensity parameter of the lights will define the additive brightness of the lighting system.

note

The first argument should be application_surface.

compare

Ambient Light Color

The ambient color is the lighting that affects the whole screen and by default is black.
You can set the ambient color with the following function

glr_set_ambient_color(my_color);

Ambient Light for Day-Night Cycle

If you want a day-night cycle in your game, you can set the colors of each day phase and glare will blend them according to the time of the day

glr_set_ambient_daytime_colors(midnight, sunrise, noon, afternoon, evening)

Example

glr_set_ambient_daytime_colors(c_black, c_gray, c_white, c_gray, c_dkgray);

Then you just need to update the daytime with the following function:

glr_set_ambient_daytime_colors(c_black, c_gray, c_white, c_gray, c_dkgray);

That calculates automatically the color of the ambient lighting and the shadow strength for directional light.