-
- std::string vert_shader =
- "#version 130 \n"
- "in vec2 position; \n"
- "in vec2 texcoord; \n"
- "out vec2 tc; \n"
- " \n"
- "void main() \n"
- "{ \n"
- " gl_Position = vec4(2.0 * position.x - 1.0, 2.0 * position.y - 1.0, -1.0, 1.0); \n"
- " tc = texcoord; \n"
- " tc.y = 1.0 - tc.y; \n"
- "} \n";
- std::string frag_shader =
- "#version 130 \n"
- "in vec2 tc; \n"
- "uniform sampler2D tex; \n"
- "void main() { \n"
- " gl_FragColor = texture2D(tex, tc); \n"
- "} \n";
- program_num = resource_pool->compile_glsl_program(vert_shader, frag_shader);
-
- static const float vertices[] = {
- 0.0f, 2.0f,
- 0.0f, 0.0f,
- 2.0f, 0.0f
- };
- glGenVertexArrays(1, &vao);
- glBindVertexArray(vao);
- position_vbo = movit::fill_vertex_attribute(program_num, "position", 2, GL_FLOAT, sizeof(vertices), vertices);
- texcoord_vbo = movit::fill_vertex_attribute(program_num, "texcoord", 2, GL_FLOAT, sizeof(vertices), vertices); // Same as vertices.
-
-#if 0
- // Cleanup.
- cleanup_vertex_attribute(phases[0]->glsl_program_num, "position", position_vbo);
- cleanup_vertex_attribute(phases[0]->glsl_program_num, "texcoord", texcoord_vbo);
-
- glDeleteVertexArrays(1, &vao);
- nheck_error();
-#endif