Render GLCanvas with PGraphics

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Render GLCanvas with PGraphics

SwitchOn
Hello,

I am trying to integrate a component which is extending a GLCanvas in my existing application. My problem is, that I am already using a Java framework in which I can not add a GLCanvas by using the "add(comp)" method. I can not use this "add(comp)" method because all UI Elements of the other framework which I am using are then behind the added GLCanvas.

In order to render visible objects in this framework, there is a method which is called on every frame and this method gets a "PGraphics" object as an argument.

Would it be possible to integrate the GLCanvas-component in the existing application by directly rendering the GLCanvas with the help of this PGraphics (or PGraphicsOpenGL) object?
Reply | Threaded
Open this post in threaded view
|

Re: Render GLCanvas with PGraphics

gouessej
Administrator
ac should be able to help you.
Julien Gouesse | Personal blog | Website
ac
Reply | Threaded
Open this post in threaded view
|

Re: Render GLCanvas with PGraphics

ac
Hello, you should be able to add you own GLCanvas to an application using Processing. In fact the new version of PGraphicsOpenGL (only in the repo at this point, but a new alpha should be out soon), does precisely that when you create an offscreen surface with createGraphics(w, h, P3D).

Reply | Threaded
Open this post in threaded view
|

Re: Render GLCanvas with PGraphics

SwitchOn
Hi,

and is there a way to render the custom GLCanvas with the given PGraphics object of the PApplet? I can't add the custom GLCanvas with the "add(comp)" method, because I want to be able to lay other ui components over this new custom GLCanvas. The framework that I am already using for my application is build with processing and it draws all ui elements with this PGraphics object. The problem is, that these ui elements are behind the custom GLCanvas, when I am adding this with "add(canvas)".
ac
Reply | Threaded
Open this post in threaded view
|

Re: Render GLCanvas with PGraphics

ac
Well, the rendering model of PGraphics is designed to work with a single GLCanvas attached to the parent PApplet. I imagine that you could add more GLCanvas objects to the PApplet, but then you would need to use a layout that accommodates all of them at once, but this will probably break other things in PApplet. You can always create as many offscreen surfaces as you want using FBOs and compositing them onto the main GLCanvas as regular images.