OpenGL draws wrapped textures (OpenTK)
Solution 1:
Your texture is wrapped incorrectly because you are using the x and y components of the vertex coordinates for the texture coordinates.
When a named buffer object is bound, to the ArrayBuffer
,target, the last argument of VertexAttribPointer
is treated as a byte offset into the buffer object's data store.
You need to specify the offset for the texture coordinates. The offset is 3 * sizeof (float)
, since the attribute buffer begins with the three components of the vertex coordinates, followed by the texture coordinates:
GL.VertexAttribPointer(1, 2, VertexAttribPointerType.Float, false, 5 * sizeof(float), 0);
GL.VertexAttribPointer(1, 2, VertexAttribPointerType.Float, false,
5 * sizeof(float), 3*sizeof(float));