-1
\$\begingroup\$

I'm following a tutorial on Youtube for OpenGL with LWJGL 3 game development by ThinMatrix. Got to loading custom .obj files. I can only run the provided stall and dragon object. Cannot run my own models created with Blender 2.78. Getting this error:

java.lang.NumberFormatException: For input string: ""
    at java.lang.NumberFormatException.forInputString(Unknown Source)
    at java.lang.Integer.parseInt(Unknown Source)
    at java.lang.Integer.parseInt(Unknown Source)
    at tk.kerdo.gfx.OBJLoader.processVertex(OBJLoader.java:97)

My .obj loader: https://pastebin.com/zSVDtsRr My .obj file: https://pastebin.com/k5LZFsRN

How can I change my .obj loader engine to work with my current and new models?

Thanks,

Kerdo K.

\$\endgroup\$
0
\$\begingroup\$

Your obj file doesn't have UV coordinates. Make sure you unwrap your object before you export it (Here's how you do it in blender)

\$\endgroup\$
  • \$\begingroup\$ Thank you! Got it working after trying that! Now just have to tinker around with the settings and I'll be done! \$\endgroup\$ – Kerdo Nov 5 '17 at 19:43
  • \$\begingroup\$ You also have to triangulate your 3d model before exporting to the game engine, since yourobj loader doesn't support anything else \$\endgroup\$ – user100681 Nov 6 '17 at 6:47
  • 1
    \$\begingroup\$ (modern) Opengl doesn't support anything else. Also I would pick a different format than obj. It's horrible as a asset format. \$\endgroup\$ – ratchet freak Nov 6 '17 at 9:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.