I want to avoid the problems that will come about with OpenGL3.2 and it’s dropping of glVertex().

for this reason I do the following:

glBegin(GL_TRIANGLES);

glVertexAttrib3f(0, …); // vertex coordinates

glVertexAttrib2f(1, …); // texture coordinates

glVertexAttrib3f(0, …); // vertex coordinates

glVertexAttrib2f(1, …); // texture coordinates

glVertexAttrib3f(0, …); // vertex coordinates

glVertexAttrib2f(1, …); // texture coordinates

// more such calls for more triangles

glEnd();

The triangles appear to be rendered at correct coordinates but only the first triangle is textured correctly, all others are textured incorrectly. It looks as if t was interpolated incorrectly. What kind of mistake am I making? Here are my bare-bones shaders.

// vertex shader

uniform mat4 model_view_matrix;

uniform mat4 projection_matrix;

in vec3 in_position;

in vec2 in_texcoords;

varying vec2 out_texcoords;

void main()

{

out_texcoords = in_texcoords;

gl_Position = projection_matrix * model_view_matrix *

vec4(0.5 * in_position, 1);

}

// fragment shader

uniform sampler2D texture0;

in vec2 out_texcoords;

void main()

{

gl_FragColor = texture2D(texture0, out_texcoords);

}