Method GL.GLSLUtils.GLSLProgram()->compile_file()
- Method
compile_file
int
compile_file(string
file_name
)- Description
Compile the shader source found in
file_name
. If filename is relative, the paths added by add_shader_path will be searched. If -1 is returned, no file was compiled.This function is usually called from the create method, but if no filename is passed there you can call this function (or the compile_string function) to specify the source.
The file is compiled twice, once with VERTEX_SHADER defined, the other time with FRAGMENT_SHADER defined.
The functions vertex_main and fragment_main are special, in that when the vertex shader is compiled vertex_main is renamed to main and fragment_main is totally removed from the source. When the fragment shader is compiled it's the other way around.