blob: 6efb71005a0590b82e6ccfcec2bb5af3d7137a1a (
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
|
const static char* default_tex = "_tex0_";
const static 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).
*/
|