GL_QUADS is deprecated, seemingly, so rearrange things a bit so that
they become small triangle strips instead.
// Now draw!
float vertices[] = {
// Now draw!
float vertices[] = {
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.
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);
check_error();
cleanup_vertex_attribute(glsl_program_num, "position", position_vbo);
// 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[] = {
// 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.25f, 0.0f,
0.75f, 0.0f,
0.25f, 0.0f,
0.75f, 0.0f,
- 0.75f, 0.0f,
- 0.25f, 0.0f
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);
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);
check_error();
cleanup_vertex_attribute(glsl_program_num, "position", position_vbo);
// Draw the texture stretched over a long quad, interpolating it out.
float vertices[] = {
// Draw the texture stretched over a long quad, interpolating it out.
float vertices[] = {
0.25f, 0.0f,
0.75f, 0.0f,
0.25f, 0.0f,
0.75f, 0.0f,
- 0.75f, 0.0f,
- 0.25f, 0.0f
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);
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);
check_error();
cleanup_vertex_attribute(glsl_program_num, "position", position_vbo);