-
Notifications
You must be signed in to change notification settings - Fork 1
Shaders
Setting up shaders happens when calling init_window
, here the arguments uniform_enum
, attribute_enum
and shader_folder
dertermine what uniforms are allowed, what attributes are allowed and what folder shaders are loaded from. uniform_enum
and attribute_enum
are required but shader_folder
can optionally be set to nil
. This will result in furbs not loading any shaders from the files system.
Passing nil
for shader_folder
will disable the following functionality:
- Hot reloading shaders (
reload_shaders
) - The
include
statement in the shader
A shader (vs or fs) can be loaded manually by calling ?????_shader
.
?????_shader
takes in a name for the shader, this name is used to identify the shader when calling load_shader
.
load_shader
will create a shader program consisting of the named vertex/frament code.
Geometry shaders are not supported in furbs. Tessellation shaders are planed, but not yet developed.
Shaders are written in GLSL and with the ability to include other files into the shader with the include
statement (disabled if shader_folder
is nil).
A shader shall be bound before drawing a mesh and is bound with bind_shader
and unbound with unbind_shader
. A camera must be setup with begin_mode_2D
/begin_mode_3D
before the shader is bound. Binding the shader will update the following uniforms:
- prj_mat
- inv_prj_mat
- view_mat
- inv_view_mat
init_shaders
is called by init_window
, so it should not be called by the user.