From ba1339c311f67fa4718e6995d8bc446ac45e3244 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Sat, 8 Mar 2014 21:44:43 +0100 Subject: [PATCH] Use triangle strips instead of quads. GL_QUADS is deprecated, seemingly, so rearrange things a bit so that they become small triangle strips instead. --- effect_chain.cpp | 6 +++--- init.cpp | 20 ++++++++++---------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/effect_chain.cpp b/effect_chain.cpp index 3376daa..7d19ac3 100644 --- a/effect_chain.cpp +++ b/effect_chain.cpp @@ -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); diff --git a/init.cpp b/init.cpp index b7604e4..1d7c46a 100644 --- 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); -- 2.39.2