FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Topics & Contributions
   Tools
(Moderator: REAS)
   Integrating jogl with 0068...
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: Integrating jogl with 0068...  (Read 1596 times)
Philipp

WWW Email
Integrating jogl with 0068...
« on: Dec 8th, 2004, 7:40pm »

http://www.repeatwhiletrue.com/p5/P5JOGL.html
 
Here's a work-in-progress tutorial for the integration of the jogl OpenGL bindings with Processing 0068. It's supposed to serve as a temporary solution until Processing's own renderer will offer OpenGL support.
 
Cheers,
Philipp
 
TomC

WWW
Re: Integrating jogl with 0068...
« Reply #1 on: Dec 8th, 2004, 11:02pm »

This sounds really great, and I'll give it a proper look at the weekend.
 
Any indication of performance?  Will it work as an applet?
 
In case you didn't know, GL bindings are being worked into Processing's latest beta version (only available to a small group of testers) right now.
 
If you can work out the right OpenGL set-up to get the Push Pop example to work, I'd be interested to know how you did it, because that's what got me stumped
 
http://processing.org/learning/examples/push_pop.html
 
« Last Edit: Dec 8th, 2004, 11:06pm by TomC »  
v3ga

WWW Email
Re: Integrating jogl with 0068...
« Reply #2 on: Dec 9th, 2004, 12:04am »

I've quickly read the tutorial, it seems to be really cool and above all very instructive.
 

http://v3ga.net
Philipp

WWW Email
Re: Integrating jogl with 0068...
« Reply #3 on: Dec 9th, 2004, 10:50am »

I've ported over the Push Pop example. You can find it here:
http://www.repeatwhiletrue.com/p5/oglexamples/ex_PushPop.pde
This example isn't the easiest to start with though, as it combines a fair amount of separate issues such as lighting, matrix transforms and drawing code. (I couldn't find a primitive box() function in OpenGL; there are primitives for spheres, cylinders and discs in GLU though)
It doesn't look exactly like the Processing example, but I suppose that is mainly an issue of fiddling with the light and normal vectors.
 
I'll port some more examples as soon as I get the chance, using the framework sketch at the end of my tutorial. If there are suggestions as for which examples you'd like to see, send them my way.
 
As for performance, jogl is *extremely* fast. The only bottleneck are the function calls from java to c, so if you use display lists, vertex buffers and the like to minimise your gl function calls, you should hardly notice any difference between OpenGL with c and with processing.  
Of course, the usual limitations apply: OpenGL is targeted towards drawing two- and threedimensional polygon surfaces, not towards bitmap operations. You will not gain any speed if all you want to do is modify pixels. (In fact, it'll probably be quite a bit slower)
 
This won't work in an applet.  
Well, in theory it's possible to make it, but since jogl requires native code, you'd either have to sign your applets or make the user copy the libraries manually. You'd also have to add the GLCanvas to the BApplet instead of a new Frame, which isn't trivial (at least for me it isn't).
If you want to give it a shot, here is a tutorial which may get you on the right track:
http://www.stud.ntnu.no/~johanno/appletviewer.jsp?task=tutorials
 
gll

WWW Email
Re: Integrating jogl with 0068...
« Reply #4 on: Dec 12th, 2004, 7:49am »

Thx Philipp! Wow! This is Impressive!
 
On my machine [XP+AGP AssusGeForce], it's nearly 5x faster with a 3x bigger window. The fullscreen doesn't seem to work here.
 
I was working a lot with openGL and I was looking for a way to be more near of this. That's a great thing, and very well explained. Thx!
 
I'm planning to use try some of my old models soon.
 

guillaume LaBelle
madmerv
Guest
Email
Re: Integrating jogl with 0068...
« Reply #5 on: Dec 13th, 2004, 12:36am »

JOGL demos display a black screen when I try to run them after installing JOGL via JDK 1.4.2, what the dilly holmes?
 
gll

WWW Email
Re: Integrating jogl with 0068...
« Reply #6 on: Dec 15th, 2004, 5:33am »

When I modify the Window size, it crash (turns very slow and not refreshing). The same for fullScreen.
 
Is it the same problem as madmerv?
 

guillaume LaBelle
TomC

WWW
Re: Integrating jogl with 0068...
« Reply #7 on: Dec 15th, 2004, 12:28pm »

I have the same problem.  The comment in Phillipp's source suggests that resizing the window might be a problem in JOGL.  I couldn't get it to work full-screen at all (but I do have OpenGL problems on my machine anyway).
 
Philipp

WWW Email
Re: Integrating jogl with 0068...
« Reply #8 on: Dec 15th, 2004, 9:21pm »

Hi and sorry for having taken my time; I'm having a pretty busy week.
 
I've ported over some more examples to JOGL (there should be more to come, but I don't know when I'll find the time to do those). Please check the bottom of the tutorial for links and descriptions.
 
goo and TomC:
I haven't experienced problems when resizing the window. Well, except for this one:
http://www.repeatwhiletrue.com/p5/oglresize.jpg
Resizing normally executes the renderer's reshape function and when I clear the screen in this function, everything works out all right.
 
As I'm guessing that this doesn't solve your problem, do you have any further clues Are there any exceptions thrown Can you take a screenshot TomC, could you tell us about your OS and graphics hardware
 
While resizing a normal window never caused any serious trouble on my machine, fullscreen is an entirely different beast. While following everything in the tutorial gets it to run without major problems on my system, I'm not surprised that some people are having trouble. Again, please give as much information as possible. Does it go to fullscreen at all but the screen remains black Does it not go fullscreen in the first place If there's something that looks interesting or relevant on the screen, could you post a screenshot
 
After giving the whole thing some thought, one possible origin of errors that comes to my mind in the way I handle things is, that I might introduce some problems with threads... Since I call display from within loop, there'd probably be an issue if display were called again whilst still running. I'll look into that.  
It's a long shot, but if you're experiencing problems, try limiting the framerate of the Processing app by calling framerate(30) in setup(). Perhaps also add a gl.glFlush() at the end of your display() function.
 
You might also want to check the JOGL board at
http://www.javagaming.org/cgi-bin/JGNetForums/board_jogl.html
to see if people have similar problems. If you find something that looks like a solution to be incorporated into this P5 hack, let us know.
 
 
to madmerv:
I've only run the demos via Java WebStart and they worked quite fine (except for the nVidia specific stuff). I have no experience in compiling them or running them locally.
However, some pointers may or may not be:
* You mention that you've installed JOGL via the JDK. Does that mean that it's possibly not in the classpath of your JRE which you use to run them
* This may be an obvious one, but if you're on a dual screen system, is the screen you're running the demos on your primary screen (this is something that got me a few times on Windows using DirectX)
* Can you run any other OpenGL applications fine Do you have the latest OpenGL drivers for your hardware (while we're at it, what type of system and hardware are you on)
* Try following the instructions for setting up part 1 of my tutorial. This uses only the most basic OpenGL stuff as opposed to the demos that are supposed to show advanced features. Does this work
 
Sorry if none of that helped you much, but if I understood you correctly, your problem is not Processing related at all. I can't say I'm an expert at JOGL. The experts are on the JOGL board, and if the demos don't run on your machine, this may be the best place to start looking.
 
 
Cheers,
Philipp
 
gll

WWW Email
Re: Integrating jogl with 0068...
« Reply #9 on: Dec 21st, 2004, 4:49am »

Hi Philipp,
 
I guess we are all busy, maybe due to the pre-christmas rush. Sorry about the delayed reponse.
 
I could send you a good screenshot at the moment, because I don't have a good OpenGL grabber installed. But when I've experienced problems with full screen mode, there was just no images.
 
I had that problem when I was working with C++. It was due to how I the OpenGL was initialized. I had a lot of trouble with FullScreen mode (at work and on my machine). You should know that I'm running on 1600x1200 resolution.
 
For the other prpoblem (the resizing one), I should make some test to tell you exactly what could be the source of the problem, but every window resizing seems to crash the rendering. [Le OpenGL est un ami capricieux]
 
I'll come back on that soon as the ruch is done.
 

guillaume LaBelle
Pages: 1 

« Previous topic | Next topic »