Hello,
I am a beginner to LWJGL and OpenGL in general, and I have been struggling to try and load models for the past few days. I think there may be something wrong with my Mesh class, as the model I see displayed is very odd and differs from what is defined in the .obj(The vertices seem to define a cube, however what I see can only be described as an eldritch horror). I have searched for long hours, trying to find fault in my Mesh class, comparing it against others, but yet I have found no error. It would be a great relief if someone more experience could review my Mesh code, as that would perhaps allow me to discard it as a possible issue in order to concentrate on the model loading part.
This is the type of eldritch horror I speak about, when it should be a simple cube:
Here is my Mesh code:
http://pastebin.java-gaming.org/9c18681505114
Here is my vertex shader:
#version 330 core
layout (location = 0) in vec3 aPos;
layout (location = 1) in vec2 aTexCoord;
layout (location = 2) in vec3 aNormal;
out vec2 TexCoord;
uniform mat4 model;
uniform mat4 view;
uniform mat4 projection;
void main()
{
gl_Position = projection * view * model * vec4(aPos, 1.0);
TexCoord = vec2(aTexCoord.x, aTexCoord.y);
}
Here is my fragment shader:
#version 330 core
out vec4 FragColor;
in vec2 TexCoord;
uniform sampler2D diffuseTex;
void main()
{
FragColor = texture(diffuseTex, TexCoord);
}
I thank you very much in advance.