| 76 | |
| 77 | |
| 78 | public class PSurfaceJOGL implements PSurface { |
| 79 | /** Selected GL profile */ |
| 80 | public static GLProfile profile; |
| 81 | |
| 82 | public PJOGL pgl; |
| 83 | |
| 84 | protected GLWindow window; |
| 85 | protected FPSAnimator animator; |
| 86 | protected Rectangle screenRect; |
| 87 | |
| 88 | private Thread drawExceptionHandler; |
| 89 | |
| 90 | protected PApplet sketch; |
| 91 | protected PGraphics graphics; |
| 92 | |
| 93 | protected int sketchWidth0; |
| 94 | protected int sketchHeight0; |
| 95 | protected int sketchWidth; |
| 96 | protected int sketchHeight; |
| 97 | |
| 98 | protected Display display; |
| 99 | protected Screen screen; |
| 100 | protected Rectangle displayRect; |
| 101 | protected Throwable drawException; |
| 102 | private final Object drawExceptionMutex = new Object(); |
| 103 | |
| 104 | protected NewtCanvasAWT canvas; |
| 105 | |
| 106 | protected int windowScaleFactor; |
| 107 | |
| 108 | protected float[] currentPixelScale = {0, 0}; |
| 109 | |
| 110 | protected boolean external = false; |
| 111 | |
| 112 | public PSurfaceJOGL(PGraphics graphics) { |
| 113 | this.graphics = graphics; |
| 114 | this.pgl = (PJOGL) ((PGraphicsOpenGL)graphics).pgl; |
| 115 | } |
| 116 | |
| 117 | |
| 118 | public void initOffscreen(PApplet sketch) { |
| 119 | this.sketch = sketch; |
| 120 | |
| 121 | sketchWidth = sketch.sketchWidth(); |
| 122 | sketchHeight = sketch.sketchHeight(); |
| 123 | |
| 124 | if (window != null) { |
| 125 | canvas = new NewtCanvasAWT(window); |
| 126 | canvas.setBounds(0, 0, window.getWidth(), window.getHeight()); |
| 127 | canvas.setFocusable(true); |
| 128 | } |
| 129 | } |
| 130 | |
| 131 | |
| 132 | public void initFrame(PApplet sketch) { |
| 133 | this.sketch = sketch; |
| 134 | initIcons(); |
| 135 | initDisplay(); |