frame -> tex
This commit is contained in:
+20
-20
@@ -18,23 +18,23 @@ static char *vertex_shader_text =
|
||||
static char *output_shader_text = "#version 460\n"
|
||||
"in vec2 vUV;\n"
|
||||
"out vec4 fragColor;\n"
|
||||
"uniform sampler2D frame0;\n"
|
||||
"uniform sampler2D tex0;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" fragColor = texture(frame0, vUV);\n"
|
||||
" fragColor = texture(tex0, vUV);\n"
|
||||
"}";
|
||||
|
||||
static char *monitor_shader_text =
|
||||
"#version 460\n"
|
||||
"uniform sampler2D frame0;\n"
|
||||
"uniform sampler2D frame1;\n"
|
||||
"uniform sampler2D frame2;\n"
|
||||
"uniform sampler2D frame3;\n"
|
||||
"uniform sampler2D frame4;\n"
|
||||
"uniform sampler2D frame5;\n"
|
||||
"uniform sampler2D frame6;\n"
|
||||
"uniform sampler2D frame7;\n"
|
||||
"uniform sampler2D frame8;\n"
|
||||
"uniform sampler2D tex0;\n"
|
||||
"uniform sampler2D tex1;\n"
|
||||
"uniform sampler2D tex2;\n"
|
||||
"uniform sampler2D tex3;\n"
|
||||
"uniform sampler2D tex4;\n"
|
||||
"uniform sampler2D tex5;\n"
|
||||
"uniform sampler2D tex6;\n"
|
||||
"uniform sampler2D tex7;\n"
|
||||
"uniform sampler2D tex8;\n"
|
||||
"in vec2 vUV;\n"
|
||||
"out vec4 fragColor;\n"
|
||||
"float s(vec2 uv, float x0, float y0) {\n"
|
||||
@@ -44,15 +44,15 @@ static char *monitor_shader_text =
|
||||
"void main() {\n"
|
||||
" vec2 uv = vUV * 3;\n"
|
||||
" fragColor = vec4(0);\n"
|
||||
" fragColor += s(uv,0,2) * texture(frame1, uv);\n"
|
||||
" fragColor += s(uv,1,2) * texture(frame2, uv);\n"
|
||||
" fragColor += s(uv,2,2) * texture(frame3, uv);\n"
|
||||
" fragColor += s(uv,0,1) * texture(frame4, uv);\n"
|
||||
" fragColor += s(uv,1,1) * texture(frame5, uv);\n"
|
||||
" fragColor += s(uv,2,1) * texture(frame6, uv);\n"
|
||||
" fragColor += s(uv,0,0) * texture(frame7, uv);\n"
|
||||
" fragColor += s(uv,1,0) * texture(frame8, uv);\n"
|
||||
" fragColor += s(uv,2,0) * texture(frame0, uv);\n"
|
||||
" fragColor += s(uv,0,2) * texture(tex1, uv);\n"
|
||||
" fragColor += s(uv,1,2) * texture(tex2, uv);\n"
|
||||
" fragColor += s(uv,2,2) * texture(tex3, uv);\n"
|
||||
" fragColor += s(uv,0,1) * texture(tex4, uv);\n"
|
||||
" fragColor += s(uv,1,1) * texture(tex5, uv);\n"
|
||||
" fragColor += s(uv,2,1) * texture(tex6, uv);\n"
|
||||
" fragColor += s(uv,0,0) * texture(tex7, uv);\n"
|
||||
" fragColor += s(uv,1,0) * texture(tex8, uv);\n"
|
||||
" fragColor += s(uv,2,0) * texture(tex0, uv);\n"
|
||||
"}";
|
||||
|
||||
static const Vertex vertices[6] = {{{0.0f, 0.0f}}, {{0.0f, 1.0f}},
|
||||
|
||||
+5
-5
@@ -174,10 +174,10 @@ static void init_single_program(ShaderProgram *program, unsigned int i,
|
||||
}
|
||||
}
|
||||
|
||||
// create frameX uniforms pointer
|
||||
// create texX uniforms pointer
|
||||
for (j = 0; j < TEX_COUNT; j++) {
|
||||
sprintf(name, "frame%d", j);
|
||||
program->frames_locations[i][j] =
|
||||
sprintf(name, "tex%d", j);
|
||||
program->textures_locations[i][j] =
|
||||
glGetUniformLocation(program->programs[i], name);
|
||||
}
|
||||
|
||||
@@ -291,9 +291,9 @@ void shaders_apply(ShaderProgram program, Context context) {
|
||||
glUniformSubroutinesuiv(GL_FRAGMENT_SHADER, 3, subroutines);
|
||||
}
|
||||
|
||||
// set GL_TEXTURE(X) to uniform sampler2D frameX
|
||||
// set GL_TEXTURE(X) to uniform sampler2D texX
|
||||
for (j = 0; j < TEX_COUNT; j++) {
|
||||
glUniform1i(program.frames_locations[i][j], j);
|
||||
glUniform1i(program.textures_locations[i][j], j);
|
||||
}
|
||||
|
||||
glDrawBuffers(TEX_COUNT - 1, program.draw_buffers);
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@ typedef struct ShaderProgram {
|
||||
GLuint ifps_locations[FRAG_COUNT];
|
||||
GLuint ires_locations[FRAG_COUNT];
|
||||
|
||||
GLuint frames_locations[FRAG_COUNT + 1][TEX_COUNT];
|
||||
GLuint textures_locations[FRAG_COUNT + 1][TEX_COUNT];
|
||||
|
||||
GLuint sub_src_indexes[FRAG_COUNT][SUB_COUNT];
|
||||
GLuint sub_fx_indexes[FRAG_COUNT][SUB_COUNT];
|
||||
|
||||
Reference in New Issue
Block a user