gl01/internal/igwrap/backend/shader.vert

32 lines
573 B
GLSL

#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)
uniform mat4 projection;
uniform int flags;
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;
}