aboutsummaryrefslogtreecommitdiff
path: root/src/libjin/Graphics/base.shader.h
blob: 4ab3f7a58599c2afa214d5d5be4b2f50242075d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

static const char* default_tex = "_tex0_";

static const char* base_shader = R"(
#define number  float 
#define Texture sampler2D 
#define Canvas  sampler2D 
#define Color   vec4
#define Texel   texture2D
#define extern  uniform 

extern Texture %s;
%s
void main()
{
    gl_FragColor = effect(gl_Color, %s, gl_TexCoord[0].xy, gl_FragCoord.xy);
}
)";
#define formatShader(buf, program)\
        sprintf(buf, base_shader, default_tex, program, default_tex)
/*
 * https://stackoverflow.com/questions/10868958/what-does-sampler2d-store
 * The sampler2D is bound to a texture unit. The glUniform call binds it to texture 
 * unit zero. The glActiveTexture call is only needed if you are going to use multiple 
 * texture units (because GL_TEXTURE0 is the default anyway).
*/