GLTF Parser in Kotlin


  • I am trying in Kotlin to create a program that reads a GLTF file and display it’s content using OpenGL.
  • Performing checks such that the vertex data is inside the Accessors’ min and max ranges fails.
  • Quick println() debugging reveals that float exponents are in the ranges +30 and -30,no inbetween.

repository: GitHub - Kss0N/KLTF: Kotlin sample reading a GLTF file and displays it using OpenGL.

After taking a closer look at the java.nio buffers I found that they use BIG_ENDIAN encoding and further more, everytime you allocate(), duplicate() or cast asReadOnlyBuffer(), the endianness resets to BIG_ENDIAN. Thus to solve it, everytime those operations are used, subsequent calls to order(LITTLE_ENDIAN) are required.