I need some C# OpenGL help. Im still kinda new to OpenGL and making a little render engine! The rendering works fine but today I added an OBJ File loader, which also worked fine but the UV is messed up. I used a File Parser made by chrisjansson on GitHub. (Link to the repo) The parser Works fine and returns the right values but Im not sure if Im using them correctly
Here's a screenshot of the Vertices and Normals working loaded from OBJ file (I disabled UVs in the shader for this)
But if I enable UVs this is what happenes:
Also yeah my texture is beautiful and right here if it helps
And here is my Code:
var objLoaderFactory = new ObjLoaderFactory();
var objLoader = objLoaderFactory.Create();
var fileStream = new FileStream(path, FileMode.Open);
var result = objLoader.Load(fileStream);
List<Vector3> verts = new List<Vector3>();
List<uint> elements = new List<uint>();
List<Vector3> normals = new List<Vector3>();
List<Vector2> uvs = new List<Vector2>();
foreach (Vertex v in result.Vertices)
{
verts.Add(new Vector3(v.X,v.Y,v.Z));
}
foreach (Normal n in result.Normals)
{
normals.Add(new Vector3(n.X,n.Y,n.Z));
}
foreach (Tex t in result.Textures)
{
uvs.Add(new Vector2(t.X,t.Y));
}
foreach (Group g in result.Groups)
foreach (Face f in g.Faces)
foreach (FaceVertex i in f._vertices)
elements.Add((uint)i.VertexIndex - 1);
I can also provide the obj file if needed!
Hope you people can help me! :P