gl01/internal/igwrap/backend/shader.vert

32 lines
573 B
GLSL
Raw Normal View History

2022-01-20 21:58:50 +08:00
#version 330
#define FLAG_RED (1<<0)
#define FLAG_GREEN (1<<1)
#define FLAG_BLUE (1<<2)
#define FLAG_ALPHA (1<<3)
#define FLAG_COLORS (FLAG_RED | FLAG_GREEN | FLAG_BLUE | FLAG_ALPHA)
#define FLAG_LINEAR (1<<4)
#define FLAG_IMGUI_FONT (1<<5)
#define FLAG_FLIP_Y (1<<6)
2022-01-20 21:58:50 +08:00
uniform mat4 projection;
uniform int flags;
2022-01-20 21:58:50 +08:00
in vec2 pos;
in vec2 uv;
in vec4 color;
out vec2 fragUV;
out vec4 fragColor;
void main() {
fragUV = uv;
fragColor = color;
gl_Position = projection * vec4(pos.xy, 0, 1);
if ((flags & FLAG_FLIP_Y) != 0)
fragUV.y = 1 - fragUV.y;
2022-01-20 21:58:50 +08:00
}