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