Thank you very much GKW for this nice example. It work fine on my pc (W2000, Radeon 8500). I understand my mistakes. I will try it under Linux, but I am not sure that pbuffers are available in the ATI driver under Linux.
Phil.
Thank you very much GKW for this nice example. It work fine on my pc (W2000, Radeon 8500). I understand my mistakes. I will try it under Linux, but I am not sure that pbuffers are available in the ATI driver under Linux.
Phil.
In response to GKW’s last message…
Great! I’ll wait for your example with baited breath!
The demo is up at the same place. Again just type:
java -jar PBDemo.jar
You can change the max size to 4096, recompile, and it should work. I don’t have your card so I don’t know if that will work or not.
Wow, thank you very much for the post! I’m sorry I only got to testing it yesterday, got sidetracked by an urgent project.
I tested the code on my system and it works. I was able to save the scene as an image which is precisely what I want!
But a whole lot of new questions arose and I would like to describe one of my applications in some detail so I can my questions in context. I have an application which has live 3d rendering so I have a bona fide canvas in a real window, etc. There are massive vertex list which were constructed with the canvas as the GLDrawable input. Now every once in a while (often!) I have a need to “take a picture” of the scene, usually with identical view and projection settings but with different aspect ration and dramatically different resolutions. So that’s the situation and here are my questions:
Once again, very many thanks. It’s beginning to look like the switch to Jogl will actually work!!!
Dola
[quote]1. Do I have to regenerate the lists with the pbuffer as the GLDrawable?
[/quote]
No, the pbuffer shares display lists with its parent drawable. Presumably there should be some way of disabling this but for now it’s hard-wired.
[quote]2. If yes, can I change the dimensions of the pbuffer without regenerating the lists? It would be a significant drag on the resources if I had to regenerate the lists every time I change the resolution.
[/quote]
Right now JOGL’s pbuffers don’t support resolution changes; setSize() throws an exception. Unfortunately they also don’t get disposed correctly yet so that creating a new one each time you need to change resolution will eventually run out of resources. You can work around this by making one as large as you’re going to need at the beginning of your program. Once you run up against these limitations please feel free to file a bug.
[quote]3. Can I have my regular canvas createOffscreenDrawable()?
[/quote]
Yes, that’s how it’s intended to work.
[quote]4. What does it mean that “PBuffers are lazily created”?
[/quote]
It means that if you call display() immediately after creating the GLPbuffer then it is not guaranteed that your GLPbuffer will call your GLEventListener. Often it takes one or more calls to display(); additionally the parent GLDrawable needs to be visible.
[quote]5. Finally, do I have to have a GLEventListener? Since I have my GLDrawable (the pbuffer!) can I just give gl commands?
[/quote]
You need a GLEventListener as with any other GLDrawable. It is only valid to call OpenGL from within that GLEventListener’s display (), init(), and reshape() methods as usual.
Thank you so much for addressing each one of the questions. You guys are great!
One more though (since I don’t seem to get this to work in the context of my application).
Does the canvas and the pbuffer each need its own GLEventListener you can they share one? Especially in my case where the drawing is presumably the same.
Thanks.
[quote]Does the canvas and the pbuffer each need its own GLEventListener you can they share one? Especially in my case where the drawing is presumably the same.
[/quote]
They can share the same GLEventListener although you need to be careful about thread-safety issues, in particular if your GLEventListener has any state in it. You may want to instantiate two objects of the same class rather than trying to share the same listener object between the drawables.