Hi all there!
I am a C/C++ programmer, although I am not a pro, I think I’m quite expert on my skills, being some years I work with those two languages.
I needed to take a look at this “Java” thing everybody keeps talking about so figure my amusement when I read about JOGL!
There were only few third-party demos on the JOGL’s homepage so I wanted to contribute something which could have been used. As it turns out, I believe my program is now rather uninteresting by a strict JOGL point of view, yet you may find it interesting.
The app can be <a href="http://digilander.libero.it/krohm/java/PE/delayLines.jnlp>launched thuru Java Web Start, just to take a look at it (but I suggest to keep on reading before trying).
I usually don’t make things without a real target. This application was meant to deliver “3d experience” and additional information, mainly for (yet simple) educational purposes giving edutainment.
I didn’t want it to crash against other programs and I wanted it to be easily integrable with usual content creation mechanism. For this reason, I wanted to display the information on a floating browser window which, for more consistent user experience, it’s the default browser. I though this was a good idea but it turned out its behaviour is simply too unpredictable and sometimes very annoying to use it. I’m not going to fix this.
In the beginning, it was an applet. I didn’t manage to make JOGL ran on applets and Sun itself seems to be pushing for applets to go to JWS anyway, so I ported it in its early days (it was just a bunch of lines of code that time).
As it turns out, the strict relation between applets and browsers would have been a definite need but somehow Sun forgot to port the same functionalities to BasicService (I can see it takes some major efforts but I don’t believe it’s too much considering all they have already done).
Another thing which really didn’t fit in JWS (as currently implemented at least) is program’s data-driven approach.
I believe I could have used two jars, one for the application and one for the script. I didn’t like this however and I never tried. By sure means, having jar+text isn’t going to work.
So, what the program does?
From its jnlp file, it loads up a script provided in the .jar, then it parses it all and generates all the needed informations to display (and to some degree, to animate) the 3d meshes required.
It’s basically a very simple scene graph.
I know there’s some fuss about “parsing” and “scripting languages” so maybe you find it interesting.
The bad problem is that 1- the parsing works but error reporting is broken and 2-there are 2 parsing styles, token-based and char-based. This makes things look very ugly.
In the end, it all boils down to identifying characters. As you can see, it works pretty nicely.
By a GL point of view, I believe it’s a shame. Choppy vertex lighting and nothing more, not even texturing or blending. Lack of texturing is a design choice, while blending would have required some more complicated machinery to get it render correctly.
However, everything is done thuru vertex arrays and the rendering method is pretty easy to follow.
JOGL demos are usually a single big file which can span over 600 lines of code. By contrast, here the rendering code is clearly separated in three files. It turns our that one of this files is actually ~500 lines because it needs to support the extensive parsing facilities of derived objects. I am thinking on separating its code from the purely geometrical one but I need some time to evaluate the conseguences.
EDIT: what I meant here about the demos is that they can discurage beginners but their usefulness is out of question. I have used them as a reference and I know they come in handy.
For now, feedback are welcome.
As for the source code, it took roughtly 3 weeks to develop this and it turned out to be pretty ugly for my own standards. It’s not a mud ball but I believe I am not the only one feeling unconfortable with it.
Please leave me few days to take a breath and recheck it before releasing to the public. I also want to be sure all the comments are in english.
So, when to expect source?
Quite unluckly, I am quite pressed on some problems to solve. I’ll be away from my PC from 4-6Sept (although I think I may have access to internet and reply here in case some questions arises).
After this, I’ll be away from 13-20 for work-related issues.
I hope you understand I have to put this down on the TODO list.
This period also works as a debugging run. It’ll be easier for everyone if code is already debugged before going to public.
I would appreciate testing “as is” and with your own script file (as a second robustness test)
I hope I didn’t bore you too much,
Massimo