How to import OPENGL library

I would like to create 3D shapes using OPENGL or P3D mode.
However, when I tried to import OPENGL library via Sketch menu (Sketch>Import Library), it is not there?
Thanks for help.

1 Like

import is not needed. (only in VERY old versions)

Here is a simple Example.

Check out the tutorial: P3D \

Warm Regards,


Full Sketch

// P3D Example

void setup() {
  size( 800, 800, P3D );   
} // setup

void draw() {

  float weight=55;
  translate(width/2, height/2+110); 
  fill(255, 0, 0); 
  box(weight, weight, weight*2);  
} // draw

When I run the above example on my MAC, these errors came up on my sketch console and the output screen is blank. I am using Processing version 3.5.4

AppKit 0x00007fff22c948bf -[NSWindow(NSWindow_Theme) _postWindowNeedsToResetDragMarginsUnlessPostingDisabled] + 352
1 AppKit 0x00007fff22c7f561 -[NSWindow _initContent:styleMask:backing:defer:contentView:] + 1375
2 AppKit 0x00007fff22c7effb -[NSWindow initWithContentRect:styleMask:backing:defer:] + 42
3 libnativewindow_macosx.jnilib 0x000000013b1d53fe Java_jogamp_nativewindow_macosx_OSXUtil_CreateNSWindow0 + 398
4 ??? 0x000000011388ea88 0x0 + 4622707336

1 Like


I can’t help you, I don’t have a Mac. Sorry!

Maybe update your graphic cards driver? OpenGl?

1 Like

I don’t have a Mac either, but I happened to see this on the forum earlier. TLDR try adding a frameRate call after size.

size(800, 800, P3D);

I was the forum member that posted the suggestion to add the frameRate and when added it did allow the sketches using P3D to run properly when executed within the Processing IDE - but if you then try to export the sketch and imbed Java, the exported app fails. Again I encountered this when I migrated from an older MacBook Pro to a new one with the M1 processor. I expect more will begin encountering this issue in the near future.

1 Like

Thanks @rbrauer @RetProf for the frameRate solution.
After inserting frameRate as suggested, messages in red (as above) are still displayed on the sketch console but the sketches work, with output displayed, which is good.
Another observation is, this is happening on my MAC processor which is not an M1 but ‘4.2 GHz Quad-Core Intel Core i7’.

1 Like

Glad it helped.

Are you able to export the sketch and when you do, does it function properly?

Which renderer are you using with the your sketch?

The sketch, with Java imbedded, exported OK (File>Export Application), however it wouldn’t run.
I get the error message “‘sketchname’ quit unexpectedly” when I double-clicked on it.
The renderer used is P3D.

Sorry to hear that your exported app failed to execute, but that is the same problem I have encountered. I was hopefully that someone in the Forum has the background to help identify the cause and eventually we’ll find a fix. Since we are using different processors and OS versions, I am guessing it is related to the issues with the Processing IDE and its ability to support changes associated with recent Apple developments. I will keep exploring this issue and if I find a resolution, I will post it.


BTW, for the OS I am using: MacOS BigSur version 11.1
The other specs as mentioned earlier are:
Processor: 4.2 GHz Quad-Core Intel Core i7
Processing: version 3.5.4

1 Like

Thank you for this additional info. This seems to point to the cause of the problems noted as the new macOS 11.1. Processing is explicit in indicating that macOS 10.13 is the most up-to-date OS that it supports. I am hopeful that eventually the new OS will be supported, as they have been amazing in the continued development of the Processing IDE. So far, with only a few small gliches, the sketches run in the IDE and eventually I expect they can be exported. Fingers crossed.

1 Like

I got almost the same setup and no luck so far exporting an app.
Do you have any new insights?

Whats the actual difference between the app running from the IDE and the exported application?

I tested the sketch again and it looks like it works as before, that is,
it works with framerate but not without (as discussed above).

After exporting application, it should create a stand-alone executable file where you can double-click to run/execute, without a need to open sketch and run via IDE development screen
(I have yet to fully test this feature myself).

Yup, this is resolved in Processing 4.0 beta 2, but there is still some work to be done.

“Export to Application no longer broken when using P2D or P3D on macOS. (Though if you’re a macOS developer, we could use some help) #249

Hello, I am wanting to use opengl with processing to try to animate a 3d model with lots of moving parts. I am trying to copy off of apple’s face tracking emoji animator. So I plan to make import an emoji model from blender that is rigged and use opencv to capture my face then animate the model based on the camera data. How can I do this? I was also told something about needing Vector Shaders? Is this doable in processing java?

Hello @code_X,