Integrating Proscene and GLGraphics   4 comments

Jean Pierre Charalambos recently released the version 1.0 of his Proscene library. Proscene is a Processing library that handles camera and coordinate system transformations in order to simplify the creation of interactive 3D scenes. In principle, Proscene can use any 3D renderer in Processing (P3D, OPENGL, GLGraphics), but we have been working together to allow for a better integration of Proscene and GLGraphics, in particular for offscreen rendering.

The basic element in Proscene is the Scene class, that includes a camera with several movement modes, an interactive frame, as well as keyboard and mouse handling. By default, a Scene object will draw onto the main output window, however it now can accept a GLGraphicsOffScreen renderer as an argument in its constructor. When doing this, the scene rendering will be directed to the offscreen surface instead:

void setup() {
  size(640, 360, GLConstants.GLGRAPHICS);
  canvas = new GLGraphicsOffScreen(this, width, height);
  scene = new Scene(this, canvas);
  ...
}

Next, the offscreen drawing of the scene should be done enclosed between the beginDraw()/endDraw() calls of both the GLGraphicsOffScreen and Scene objects, in that order:

void draw() {
  ...
  canvas.beginDraw();
  scene.beginDraw();
  canvas.fill(204, 102, 0);
  ...
  scene.endDraw();
  canvas.endDraw();
  ...
}

The latest Proscene package includes an example that shows this functionality, BasicUseOffscreen. Click on the image below to run the example as a web applet.

Proscene-GLGraphics

Advertisements

Posted December 22, 2010 by ac in Programming, Software

Tagged with , , , ,

4 responses to “Integrating Proscene and GLGraphics

Subscribe to comments with RSS.

  1. is there any possibility to set the mouse-control to another ‘GLTextureWindow’, to set the view inside?

    • Hello, the GLTextureWindow doesn’t offer any functionality to control the mouse pointer. This is so because the main goal of the GLTextureWindow class is just to provide non-interactive output windows, that are often useful when you need to direct the output of some rendering operation to a second monitor or projector.

      What you can do is to create a GLTextureWindow with borders and resizing enabled:

      texWin = new GLTextureWindow(this, “Output”, 0, 0, 400, 400, true, true, true);

      The three boolean arguments are;

      visible/not visible (1st)
      with/out borders (2nd)
      resizable/fixed size (3rd)

      • hm. i’m rendering a 3d scene into the GLTextureWindow, and it would be nice to control the camera-view inside of this window to…

      • One possibility to circumvent this limitation could be to have some UI operated from the main window that controls the camera settings of the image you are showing through the GLTextureWindow. Take a look at the Integration/KeystoneOutput example, this might help.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: