Hi!
I'd like to make a sketch where there are multiple viewport: for instance two of them in 3d (with peasy cam) and 2 in 2d.
Do you have anny suggestion?
right now I have multiple PApplet with the awt frame trick described but I'm looking for having only one windows with all the viewport inside..
so OpenGL and multiple viewport..
do you have any advice?
and what about the 2d? what are the "stand" camera parameters for the processing 2d drawing to set the OpenGL camera?
the only things it is missing is the peasycam integration.
to be easy: let say to apply the peasycam thing only to 1 viewport? (the one with the 2 spheres)
Use createGraphics to create a 2D or 3D buffer (viewports) draw into the viewports, then in the draw method use image to copy the viewport contents to the desired position in a P2D display
is it really working as if it is a real PApplet? no memory issues? anti-aliasing, etc?
what about for peasycam? can it take also a PGraphics as input in the constructor?
I forgot about PeasyCam, for that you do need a PApplet because it must respond to mouse events and PGraphic won't do that.
If you want to use multiple window it will be easier using the G4P library. The code below uses the default JAVA2D renderer for the main sketch wndow then creates 3 extra windows using P2D, P3D and OPENGL (with PeasyCam)
Yes I've just found the G4P library in the internet but I'm already ok with more PApplet and the PFrame thing…
thanks anyway, if some hacks ring a bell in your mind please write!
PeasyCam requires a PApplet object for its constructor when it is created so that it hooks into Processing's event thread. It would be possible to rewrite PeasyCam so that its rotation centre is moved to the centre of the 3D viewport.
I remember a hack for using viewports but that was for 1.5.1 so wouldn't work. OpenGL supports viewports but AFAIK Processing's API doesn't expose that functionality.
Answers
There are many ways to instantiate multiple PApplet apps:
http://forum.processing.org/two/discussion/5840/eclipse-multiple-frames-avoid-null-frame-value-
But doing the way described above, only 1 of them can use OpenGL though! ^#(^
right now I have multiple PApplet with the awt frame trick described but I'm looking for having only one windows with all the viewport inside..
so OpenGL and multiple viewport.. do you have any advice? and what about the 2d? what are the "stand" camera parameters for the processing 2d drawing to set the OpenGL camera?
you can just display 2d and 3D content together
that is very handy thanks
the only things it is missing is the peasycam integration. to be easy: let say to apply the peasycam thing only to 1 viewport? (the one with the 2 spheres)
Use
createGraphics
to create a 2D or 3D buffer (viewports) draw into the viewports, then in the draw method useimage
to copy the viewport contents to the desired position in a P2D displayis it really working as if it is a real PApplet? no memory issues? anti-aliasing, etc? what about for peasycam? can it take also a PGraphics as input in the constructor?
In my sketch you can use peasycam
In all the parts where you don't need it, apply beginHUD endHUD see its reference
Quarks is better though since with mine you always have an angle (so I used ortho())
Chrisir
I forgot about PeasyCam, for that you do need a PApplet because it must respond to mouse events and PGraphic won't do that.
If you want to use multiple window it will be easier using the G4P library. The code below uses the default JAVA2D renderer for the main sketch wndow then creates 3 extra windows using P2D, P3D and OPENGL (with PeasyCam)
Yes I've just found the G4P library in the internet but I'm already ok with more PApplet and the PFrame thing… thanks anyway, if some hacks ring a bell in your mind please write!
Don't forget that
OPENGL = P3D
in Processing 2+! L-)Anyway, how to set the peasycam center?
I don't think its possible.
When you have different PGraphics each is internally centered (it's small)
Use pasycam on those PGraphics (or one of them)
Then display 4 PGraphics like images
Wouldn't that work?
@Chrisir unfortunately not, you must of missed me saying
I see...
Could he port peasycam so that it works on a PGrapics?
Or write a simple version that takes mouse input and does some rotate to a PGraphics?
PeasyCam requires a PApplet object for its constructor when it is created so that it hooks into Processing's event thread. It would be possible to rewrite PeasyCam so that its rotation centre is moved to the centre of the 3D viewport.
I remember a hack for using viewports but that was for 1.5.1 so wouldn't work. OpenGL supports viewports but AFAIK Processing's API doesn't expose that functionality.