This tutorial is for 3D first-person, third-person, or top-down games. This will emulate the sun. It will get the job done, but not look as nice as current-generation game engines. The effect should be used on a decently-sized 3D map, as the light is bright at the source.
Part 1: Add global float variable underneath the includes.
static float use_light = true;
Part 2: Add apply_effect function.
void apply_effect(void)
jo_3d_set_mesh_light(&MeshCube, use_light); /* Collada or Wavefront model */
if (use_texture)
jo_3d_set_mesh_texture(&MeshCube, 0);
jo_3d_set_light(&plane, use_light); /* Ground/Floor flat double-sided texture */
if (use_texture)
jo_3d_set_texture(&plane, 1);
Part 3: In the jo_main function, we will add the light source variable and the executable line.
jo_3d_light(1.0, 1.0, 1.0); /* Float integers (static seem to be too unwieldy). Change numbers to suit your game. */
apply_effect(); /* add above jo_core_run(); */
Notes: This code is assuming that you've already placed your landscape items into your code, and have the textures listed in jo_main. Additionally, I came up with error-free code to shine light on a drawn cube, but, for some reason, it won't take effect. Perhaps, someone else will figure that one out.