Half of my tris are textured in streaks and blurs


I have written code to import meshes from OBJs and textures from BMPs. My texture coordinates seem to be getting messed up somehow, or some other issue is occuring, because I am getting these effects with meshes and textures: enter image description here

enter image description here

I do not know what to call these issues and I do not know what might cause them (I am new to OpenGL) so it is hard for me to figure out how to fix them. Does this look familiar to anyone? If so, what’s up and how might I fix it?

Relevant code for importing mesh data:

obj.vertBufferSize = sizeof(GLfloat) * vertCount * 3; obj.uvBufferSize = sizeof(GLfloat) * vertCount * 2; obj.vertBuffer = vertBuffer; obj.uvBuffer = uvBuffer;  glGenBuffers(1, &obj.vertBufferID); glBindBuffer(GL_ARRAY_BUFFER, obj.vertBufferID); glBufferData(GL_ARRAY_BUFFER, obj.vertBufferSize, &(obj.vertBuffer[0]), GL_STATIC_DRAW);  glGenBuffers(1, &obj.uvBufferID); glBindBuffer(GL_ARRAY_BUFFER, obj.uvBufferID); glBufferData(GL_ARRAY_BUFFER, obj.uvBufferSize, &(obj.uvBuffer[0]), GL_STATIC_DRAW); 

Relevant code for importing texture data:

glGenTextures(1, &(bmp.ID)); glBindTexture(GL_TEXTURE_2D, bmp.ID);  glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, bmp.width, bmp.height, 0, GL_BGR, GL_UNSIGNED_BYTE, bmp.array);  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glGenerateMipmap(GL_TEXTURE_2D); 

Before the main loop (for sending mesh data to shaders):

glBindBuffer(GL_ARRAY_BUFFER, mesh.vertBufferID); glVertexAttribPointer (     0,     3,     GL_FLOAT,     GL_FALSE,     0,     (void*)0 );  glBindBuffer(GL_ARRAY_BUFFER, mesh.uvBufferID); glVertexAttribPointer (     1,     2,     GL_FLOAT,     GL_FALSE,     0,     (void*)0 ); 

Samples from inside the main loop:

glEnableVertexAttribArray(0); glEnableVertexAttribArray(1);      glBindTexture(GL_TEXTURE_2D, texture.ID);  glDrawArrays(GL_TRIANGLES, 0, mesh.vertCount);      glDisableVertexAttribArray(0); glDisableVertexAttribArray(1);