diff --git a/Default-shader-parameters.md b/Default-shader-parameters.md deleted file mode 100644 index fb627d6..0000000 --- a/Default-shader-parameters.md +++ /dev/null @@ -1,42 +0,0 @@ -The default shaders included in raylib defines the following default input and output parameters if no user-provided vertex or fragment shader is provided. - -Source: [rlgl.h](https://github.com/raysan5/raylib/blob/master/src/rlgl.h) - -## Default vertex shader - -OPENGL_ES2 or OPENGL_21 -``` -attribute vec3 vertexPosition; -attribute vec2 vertexTexCoord; -attribute vec4 vertexColor; -varying vec2 fragTexCoord; -varying vec4 fragColor; -``` - -OPENGL_33 -``` -in vec3 vertexPosition; -in vec2 vertexTexCoord; -in vec4 vertexColor; -out vec2 fragTexCoord; -out vec4 fragColor; -``` - -## Default fragment shader - -OPENGL_ES2 or OPENGL_21 -``` -varying vec2 fragTexCoord; -varying vec4 fragColor; -``` -OPENGL_ES2 also defines -``` -precision mediump float; -``` - -OPENGL_33 -``` -in vec2 fragTexCoord; -in vec4 fragColor; -out vec4 finalColor; -``` \ No newline at end of file diff --git a/raylib-default-shader.md b/raylib-default-shader.md new file mode 100644 index 0000000..122ebd9 --- /dev/null +++ b/raylib-default-shader.md @@ -0,0 +1,47 @@ +The default shaders included in raylib defines the following default input and output parameters if no custom shader is provided by user. + +For custom shaders usage check [raylib custom shader page](raylib-generic-uber-shader-and-custom-shaders). + +Default shader source is embedded as a string in [rlgl.h](https://github.com/raysan5/raylib/blob/master/src/rlgl.h) module. Note that there are multiple GLSL shader versions for the multiple OpenGL versions supported. + +## default vertex shader input/output parameters + +_OPENGL_ES2 or OPENGL_21_ +```glsl +attribute vec3 vertexPosition; // Vertex input attribute: position +attribute vec2 vertexTexCoord; // Vertex input attribute: texture coordinate +attribute vec4 vertexColor; // Vertex input attribute: color +varying vec2 fragTexCoord; // To-fragment attribute: texture coordinate +varying vec4 fragColor; // To-fragment attribute: color +``` + +_OPENGL_33_ +```glsl +in vec3 vertexPosition; // Vertex input attribute: position +in vec2 vertexTexCoord; // Vertex input attribute: texture coordinate +in vec4 vertexColor; // Vertex input attribute: color +out vec2 fragTexCoord; // To-fragment attribute: texture coordinate +out vec4 fragColor; // To-fragment attribute: color +``` + +## default fragment shader input/output parameters + +_OPENGL_ES2 or OPENGL_21_ +```glsl +varying vec2 fragTexCoord; // Fragment input attribute: texture coordinate +varying vec4 fragColor; // Fragment input attribute: color +``` + +_OPENGL_ES2 also defines:_ +```glsl +precision mediump float; // OpenGL ES 2.0 optimization, using 16bit floats +``` + +_OPENGL_33_ +```glsl +in vec2 fragTexCoord; // Fragment input attribute: texture coordinate +in vec4 fragColor; // Fragment input attribute: color +out vec4 finalColor; // Fragment output: color +``` + +NOTE: On _OPENGL_ES2 and OPENGL_21_ we use the default built-in fragment output `gl_FragColor` (same as the explicitly defined `finalColor`).