]> git.sesse.net Git - movit/commitdiff
Use triangle strips instead of quads.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 8 Mar 2014 20:44:43 +0000 (21:44 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 8 Mar 2014 20:57:27 +0000 (21:57 +0100)
GL_QUADS is deprecated, seemingly, so rearrange things a bit so that
they become small triangle strips instead.

effect_chain.cpp
init.cpp

index 3376daa98064df9c4e42edb2c319be6bdac9f7f6..7d19ac3eb0df29861b5a19012d81d3f6d2810bde 100644 (file)
@@ -1537,10 +1537,10 @@ void EffectChain::render_to_fbo(GLuint dest_fbo, unsigned width, unsigned height
 
                // Now draw!
                float vertices[] = {
+                       0.0f, 1.0f,
                        0.0f, 0.0f,
-                       1.0f, 0.0f,
                        1.0f, 1.0f,
-                       0.0f, 1.0f
+                       1.0f, 0.0f
                };
 
                GLuint vao;
@@ -1552,7 +1552,7 @@ void EffectChain::render_to_fbo(GLuint dest_fbo, unsigned width, unsigned height
                GLuint position_vbo = fill_vertex_attribute(glsl_program_num, "position", 2, GL_FLOAT, sizeof(vertices), vertices);
                GLuint texcoord_vbo = fill_vertex_attribute(glsl_program_num, "texcoord", 2, GL_FLOAT, sizeof(vertices), vertices);  // Same as vertices.
 
-               glDrawArrays(GL_QUADS, 0, 4);
+               glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
                check_error();
 
                cleanup_vertex_attribute(glsl_program_num, "position", position_vbo);
index b7604e4333979bcd2faa3b06f9bb46864bee8db6..1d7c46a50a63fb0cb1138f885efae4526eaaef0b 100644 (file)
--- a/init.cpp
+++ b/init.cpp
@@ -89,16 +89,16 @@ void measure_texel_subpixel_precision()
        // texture coordinates in order not to get long stretches of (1,1,1,...)
        // at the start and (...,0,0,0) at the end.
        float vertices[] = {
+               0.0f, 1.0f,
                0.0f, 0.0f,
-               1.0f, 0.0f,
                1.0f, 1.0f,
-               0.0f, 1.0f
+               1.0f, 0.0f
        };
        float texcoords[] = {
+               0.25f, 0.0f,
                0.25f, 0.0f,
                0.75f, 0.0f,
-               0.75f, 0.0f,
-               0.25f, 0.0f
+               0.75f, 0.0f
        };
 
        GLuint vao;
@@ -110,7 +110,7 @@ void measure_texel_subpixel_precision()
        GLuint position_vbo = fill_vertex_attribute(glsl_program_num, "position", 2, GL_FLOAT, sizeof(vertices), vertices);
        GLuint texcoord_vbo = fill_vertex_attribute(glsl_program_num, "texcoord", 2, GL_FLOAT, sizeof(texcoords), texcoords);
 
-       glDrawArrays(GL_QUADS, 0, 4);
+       glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
        check_error();
 
        cleanup_vertex_attribute(glsl_program_num, "position", position_vbo);
@@ -216,16 +216,16 @@ void measure_roundoff_problems()
 
        // Draw the texture stretched over a long quad, interpolating it out.
        float vertices[] = {
+               0.0f, 1.0f,
                0.0f, 0.0f,
-               1.0f, 0.0f,
                1.0f, 1.0f,
-               0.0f, 1.0f
+               1.0f, 0.0f
        };
        float texcoords[] = {
+               0.25f, 0.0f,
                0.25f, 0.0f,
                0.75f, 0.0f,
-               0.75f, 0.0f,
-               0.25f, 0.0f
+               0.75f, 0.0f
        };
 
        GLuint vao;
@@ -237,7 +237,7 @@ void measure_roundoff_problems()
        GLuint position_vbo = fill_vertex_attribute(glsl_program_num, "position", 2, GL_FLOAT, sizeof(vertices), vertices);
        GLuint texcoord_vbo = fill_vertex_attribute(glsl_program_num, "texcoord", 2, GL_FLOAT, sizeof(texcoords), texcoords);
 
-       glDrawArrays(GL_QUADS, 0, 4);
+       glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
        check_error();
 
        cleanup_vertex_attribute(glsl_program_num, "position", position_vbo);