So i'm trying to a basic opengl program that reads in an .obj
file and then renders it (the obj file contains triangle vertices in the format
v 1.000000 2.000000, 3.00000
.
So here's my code to do that (im using GLFW and a Golang binding library for it) (also im currently ignoring normals).
gl.Begin(gl.TRIANGLES)
for scanner.Scan() {
var v0, v1, v2 float32
t := strings.Split(scanner.Text(), " ")
line := scanner.Text()
fmt.Sscanf(line, "v %f %f %f", &v0, &v1, &v2)
if t[0] == "v" {
gl.Vertex3f(v0, v1, v2)
}
}
gl.End()
However when I go to run this the result isnt quite right
I tried it on a few other files I found around the internet and I get similar results. It almost seems like the triangles vertices are offset or something.