Login  Register

Re: jogl utils

Posted by Michael Bien on May 16, 2010; 4:40pm
URL: https://forum.jogamp.org/jogl-utils-tp819809p821796.html

thank you for the bug report Fred.

We are currently busy with the other 9 projects. Not sure if we will have time to maintain the utils project too (at least not now). If you can contribute in this area by committing into the repository it would be great.

git isn't that hard. Just fork the utils repository (the top right button on github) and you can start hacking.

good to know that someone actually uses the utils project - we weren't sure about that :)

best regards,

michael

Fred Vernier wrote
Thank you for supporting jogl even when Sun didn't show any support for a long time. I read other post talking about jogl, gluegen, joal and wonder about joglutils. It's still there in the Sven repository but you never mention it as live project (and it was almost dead in the previous kenai framework). There are useful stuff in there anyway like the .3ds loader. I hope it will still work. By the way I found 2 bugs and suggest one improvement in 3ds loader.

in src/net/java/joglutils/ThreeDS/Loader3Ds.java

line 447 : normals[i] = vVector2;
WHY: otherwise 2 lines after when the cross product is made it is computed between vVector1 and vVector1 => no normals are computed !!!!

line 358 and 336: all "swap(dataInputStream.readFloat())" should be replaced with something like this
declare an array of 4 byte before the loop:
"byte[] data = new byte[4];"

in the loop, read the byte as byte and swap them BEFORE converting anything to float
"dataInputStream.readFully(data);
int v  = ((data[3]&0xff)<< 24) | ((data[2]&0xff) << 16) | ((data[1]&0xff) << 8) | ((data[0]&0xff) << 0);
float f0 = Float.intBitsToFloat(v);"

do it 2 or 3 times (2 for uv, 3 for vertex) and compute f0, f1 and/or f2

finally compute the vector with f0, f1 or f0,f1, f2

WHY: because Java handle float with special values (POSITIVE_INFINITY, NaN, etc.). When a loaded float leads to such a special value it becomes impossible to swap the bytes anymore. I found a 3ds model with vertices around x~=2200.0 and about 5% of the vertices were corrupted due to this problem.

I'm sorry I can't commit my fixes. I don't know git yet and I really don;t know if I will have time to jump into it in the near future.

BTW, I suggest the tempNormal made available as a global value of the Obj (line 427 of Loader3Ds.java). It is a normal per face (instead of the normals per vertex) and I find very usefull to be able to access such normals (and as far as they are already computed...)