Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't appear to render obj files correctly. #1

Open
Roseburrow opened this issue Dec 9, 2017 · 4 comments
Open

Doesn't appear to render obj files correctly. #1

Roseburrow opened this issue Dec 9, 2017 · 4 comments

Comments

@Roseburrow
Copy link

Just renders piles of triangles with incorrect bounding box. Is this rendered unfinished or am I doing something wrong?

@ghost
Copy link

ghost commented Apr 21, 2018

Yes me same too Eh you would like to find Wavefront Loader ^^ I try create new WaveFrontLoader

@dabbertorres
Copy link
Owner

Wow I completely forgot about this! I'm sorry!

Yes, this is a case of never getting around to finishing this by getting distracted by other stuff.
I may get around to completing this.

@ghost
Copy link

ghost commented Apr 22, 2018

@dabbertorres It is okay - No problem - Github users are very busy if they don't check.. Me too. Whatever I am busy than I check later with Github.

I recommend you can try SharpGL -> ObjFileFormat.cs I am very surprised because SharpGL is really stabler than OpenTK - So sad for OpenTK cause OpenTK doesn't know like calculator of mathematics example:

Vector3[] vertices, Vector2[] uvs, Vector3[] normals and int[] faceIndices. My brother helps me but WavefrontLoader can load cause wrong unit like "float[]" than faces look very painfully. He said and tries to fix with Vector3[] and Vector2[] for vertices and uvs.

Like Neo Katubo's Example of OpenTK. So sadly television is wavefront and looks very painful like your wavefrontloader too.

I think we need improve for stable wavefront-loader.

If you try resolving with Java LwjGL with ThinMatrix Video-Tutorials I have written successful with Tutorial 01 to Tutorial 07 but it seems wrong with float[] and I have tried with WavefrontLoader than it happens like your WavefrontLoader ( Shit faces are unlimited or broken )

@OsmanGny
Copy link

OsmanGny commented Jun 4, 2020

Just renders piles of triangles with incorrect bounding box. Is this rendered unfinished or am I doing something wrong?

Float parsing not working correct in ObjLoader.cs

Example float.Parse(5.333) this returns 5333
You must change '.' char with ',' char.
And as default obj files have '.' char between numbers.

for example

		case "v":
                           //add this boys
	               words[0] = words[0].Replace('.', ',');
	               words[1] = words[1].Replace('.', ',');
	               words[2] = words[2].Replace('.', ',');
            //


	vertices.Add(new Vector4(float.Parse(words[0]), float.Parse(words[1]),float.Parse(words[2]), words.Count < 4 ? 1 : float.Parse(words[3])));
						break;

//And this is rendering codes

       GL.Begin(type);
        
        for (int i = 0; i < mesh.vertexIndices.Count - 1; i++)
        {
            GL.TexCoord3(mesh.textureVertices[(int)mesh.textureIndices[i]]);
            GL.Normal3(-mesh.normals[(int)mesh.normalIndices[i]]);
            GL.Vertex4(mesh.vertices[(int)mesh.vertexIndices[i]]);
        }
        GL.End();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants