So I’ve been trying to make a simple 3d cube in OpenGL. Creating the vertices and indices was easy, but now I have to texture it. No matter how much I mess with the texture coordinates, some sides still have warped versions of the texture.
How the texture is supposed to look on all sides:
How it looks on some of them:
My vertices and indices:
std::vector<GLfloat> vert { // vert tex coords 1, -1, 1, 1.0, 0.0, // 0 front bot right -1, -1, 1, 0.0, 0.0, // 1 front bot left -1, 1, 1, 0.0, 1.0, // 2 front top left 1, 1, 1, 1.0, 1.0, // 3 front top right -1, -1, -1, 0.0, 0.0, // 4 back bot left 1, -1, -1, 1.0, 0.0, // 5 back bot right -1, 1, -1, 0.0, 1.0, // 6 back top left 1, 1, -1, 1.0, 1.0, // 7 back top right }; std::vector<GLuint> index { 0, 1, 2, 2, 3, 0, // front 0, 1, 4, 4, 5, 0, // bottom 3, 2, 6, 6, 7, 3, // top 5, 4, 6, 6, 7, 5, // back 5, 0, 3, 3, 7, 5, // right 4, 1, 2, 2, 6, 4 // left };