|
|
@ -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`). |