mirror of
https://github.com/raysan5/raylib.git
synced 2026-02-06 14:19:18 -05:00
Updated Default shader parameters (markdown)
@ -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;
|
|
||||||
```
|
|
||||||
47
raylib-default-shader.md
Normal file
47
raylib-default-shader.md
Normal file
@ -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`).
|
||||||
Reference in New Issue
Block a user