# How to import OPENGL library

**URL:** https://discourse.processing.org/t/how-to-import-opengl-library/27387
**Category:** Processing
**Created:** [January 26, 2021, 1:39pm UTC](https://discourse.processing.org/t/how-to-import-opengl-library/27387 "2021-01-26T13:39:22Z")
**Posts on this page:** 18
**Page:** 1

<div class="post-metadata">

### Author: ![proc8888](https://avatars.discourse-cdn.com/v4/letter/p/f19dbf/32.png) [@proc8888](https://discourse.processing.org/u/proc8888)
#### Post date: [January 26, 2021, 1:39pm UTC](https://discourse.processing.org/t/how-to-import-opengl-library/27387/1 "2021-01-26T13:39:22Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)
#### Post date: [January 26, 2021, 2:07pm UTC](https://discourse.processing.org/t/how-to-import-opengl-library/27387/2 "2021-01-26T14:07:15Z")

</div>

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

Here is a simple Example.

Check out the tutorial: [P3D \ Processing.org](https://www.processing.org/tutorials/p3d/)

Warm Regards,

Chrisir

**Full Sketch**

```auto
// P3D Example

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

void draw() {
  background(0);
  lights(); 

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

```

---

<div class="post-metadata">

### Author: ![proc8888](https://avatars.discourse-cdn.com/v4/letter/p/f19dbf/32.png) [@proc8888](https://discourse.processing.org/u/proc8888)
#### Post date: [January 26, 2021, 2:33pm UTC](https://discourse.processing.org/t/how-to-import-opengl-library/27387/3 "2021-01-26T14:33:02Z")

</div>

Thanks.  
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  
)

---

<div class="post-metadata">

### Author: ![proc8888](https://avatars.discourse-cdn.com/v4/letter/p/f19dbf/32.png) [@proc8888](https://discourse.processing.org/u/proc8888)
#### Post date: [January 26, 2021, 2:36pm UTC](https://discourse.processing.org/t/how-to-import-opengl-library/27387/4 "2021-01-26T14:36:22Z")

</div>

![Screen Shot 2021-01-27 at 1.34.45 am](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/0/081bbd90b97f469e402690f2fd1d009666d4bcac.png)

---

<div class="post-metadata">

### Author: ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)
#### Post date: [January 26, 2021, 3:21pm UTC](https://discourse.processing.org/t/how-to-import-opengl-library/27387/5 "2021-01-26T15:21:42Z")

</div>

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

Maybe update your graphic cards driver? OpenGl?

---

<div class="post-metadata">

### Author: ![rbrauer](https://avatars.discourse-cdn.com/v4/letter/r/838e76/32.png) [@rbrauer](https://discourse.processing.org/u/rbrauer)
#### Post date: [January 26, 2021, 6:15pm UTC](https://discourse.processing.org/t/how-to-import-opengl-library/27387/6 "2021-01-26T18:15:58Z")

</div>

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.

```auto
size(800, 800, P3D);
frameRate(60);

```

> [@Problems with P2D and P3D renderers with new Apple M1 processor](https://discourse.processing.org/t/problems-with-p2d-and-p3d-renderers-with-new-apple-m1-processor/27287):
>
> I have encountered an issue when trying to execute sketches that function and export correctly on an older MacBook Pro when these sketches are attempted to be run on a new MacBook Pro using a new M1 processor. I have tried to use two different versions of Processing. 1) the stable 3.5.4 release (17 Jan 2021) and 2) pre-release 4.0 alpha 3 (17 Jan 2021). Both appear to have similar issues. The sketches fail - i.e. they only open a blank window and the following is displayed in the console: 0 …

---

<div class="post-metadata">

### Author: ![RetProf](https://avatars.discourse-cdn.com/v4/letter/r/9fc29f/32.png) [@RetProf](https://discourse.processing.org/u/RetProf)
#### Post date: [January 26, 2021, 7:12pm UTC](https://discourse.processing.org/t/how-to-import-opengl-library/27387/7 "2021-01-26T19:12:54Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![proc8888](https://avatars.discourse-cdn.com/v4/letter/p/f19dbf/32.png) [@proc8888](https://discourse.processing.org/u/proc8888)
#### Post date: [January 27, 2021, 3:01pm UTC](https://discourse.processing.org/t/how-to-import-opengl-library/27387/8 "2021-01-27T15:01:21Z")

</div>

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’.

---

<div class="post-metadata">

### Author: ![RetProf](https://avatars.discourse-cdn.com/v4/letter/r/9fc29f/32.png) [@RetProf](https://discourse.processing.org/u/RetProf)
#### Post date: [January 27, 2021, 5:06pm UTC](https://discourse.processing.org/t/how-to-import-opengl-library/27387/9 "2021-01-27T17:06:00Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![proc8888](https://avatars.discourse-cdn.com/v4/letter/p/f19dbf/32.png) [@proc8888](https://discourse.processing.org/u/proc8888)
#### Post date: [January 28, 2021, 1:16am UTC](https://discourse.processing.org/t/how-to-import-opengl-library/27387/10 "2021-01-28T01:16:12Z")

</div>

@RetProf  
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.

---

<div class="post-metadata">

### Author: ![RetProf](https://avatars.discourse-cdn.com/v4/letter/r/9fc29f/32.png) [@RetProf](https://discourse.processing.org/u/RetProf)
#### Post date: [January 28, 2021, 2:04am UTC](https://discourse.processing.org/t/how-to-import-opengl-library/27387/11 "2021-01-28T02:04:55Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![proc8888](https://avatars.discourse-cdn.com/v4/letter/p/f19dbf/32.png) [@proc8888](https://discourse.processing.org/u/proc8888)
#### Post date: [January 28, 2021, 12:37pm UTC](https://discourse.processing.org/t/how-to-import-opengl-library/27387/12 "2021-01-28T12:37:29Z")

</div>

Thanks.  
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

---

<div class="post-metadata">

### Author: ![RetProf](https://avatars.discourse-cdn.com/v4/letter/r/9fc29f/32.png) [@RetProf](https://discourse.processing.org/u/RetProf)
#### Post date: [January 29, 2021, 1:53am UTC](https://discourse.processing.org/t/how-to-import-opengl-library/27387/13 "2021-01-29T01:53:43Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![philipplehmann](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/philipplehmann/32/4111_2.png) [@philipplehmann](https://discourse.processing.org/u/philipplehmann)
#### Post date: [August 12, 2021, 1:36pm UTC](https://discourse.processing.org/t/how-to-import-opengl-library/27387/14 "2021-08-12T13:36:06Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![proc8888](https://avatars.discourse-cdn.com/v4/letter/p/f19dbf/32.png) [@proc8888](https://discourse.processing.org/u/proc8888)
#### Post date: [October 8, 2021, 9:59am UTC](https://discourse.processing.org/t/how-to-import-opengl-library/27387/15 "2021-10-08T09:59:33Z")

</div>

@philipplehmann  
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).

---

<div class="post-metadata">

### Author: ![philipplehmann](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/philipplehmann/32/4111_2.png) [@philipplehmann](https://discourse.processing.org/u/philipplehmann)
#### Post date: [October 11, 2021, 6:16am UTC](https://discourse.processing.org/t/how-to-import-opengl-library/27387/16 "2021-10-11T06:16:29Z")

</div>

Yup, this is resolved in [Processing 4.0 beta 2](https://github.com/processing/processing4/blob/master/build/shared/changes.md), 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](https://github.com/processing/processing4/issues/284)) [#249](https://github.com/processing/processing4/issues/249)”

---

<div class="post-metadata">

### Author: ![code\_X](https://avatars.discourse-cdn.com/v4/letter/c/47e85d/32.png) [@code\_X](https://discourse.processing.org/u/code_X)
#### Post date: [June 5, 2022, 12:16am UTC](https://discourse.processing.org/t/how-to-import-opengl-library/27387/17 "2022-06-05T00:16:11Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)
#### Post date: [June 5, 2022, 1:35am UTC](https://discourse.processing.org/t/how-to-import-opengl-library/27387/18 "2022-06-05T01:35:47Z")

</div>

Hello @code_X,

Related:

> <https://stackoverflow.com/questions/40920428/no-opengl-in-processing-3>

> [@I can't make a single shader run in Processing](https://discourse.processing.org/t/i-cant-make-a-single-shader-run-in-processing/36462/7):
>
> Problem solved finally. It seems the examples I used from online tutorials had some outdated syntax for the vertex shader. If someone need the correct one, simply check the examples/topics/shaders in your version of Processing package. I didn’t realize they had shader examples there wink

> [@Where did the (P)Shader tutorial go?](https://discourse.processing.org/t/where-did-the-p-shader-tutorial-go/32090/4):
>
> The wayback machine has a 2021-04 snapshot of the original PShader tutorial (images and all) here: [Shaders \ Processing.org](http://web.archive.org/web/20210417130804/https://processing.org/tutorials/pshader/)

`:)`
