|
23 | 23 |
|
24 | 24 | package processing.lwjgl; |
25 | 25 |
|
| 26 | +import java.awt.BorderLayout; |
26 | 27 | import java.awt.Canvas; |
27 | 28 | import java.nio.Buffer; |
28 | 29 |
|
@@ -273,39 +274,28 @@ public void updateOffscreen(PGL primary) { |
273 | 274 |
|
274 | 275 |
|
275 | 276 | public void initPrimarySurface(int antialias) { |
276 | | -// if (pg.parent.online) { |
277 | | -// // RCP Application (Applet's, Webstart, Netbeans, ..) using JOGL may not |
278 | | -// // be able to initialize JOGL before the first UI action, so initSingleton() |
279 | | -// // is called with its argument set to false. |
280 | | -// GLProfile.initSingleton(false); |
281 | | -// } else { |
282 | | -// if (PApplet.platform == PConstants.LINUX) { |
283 | | -// // Special case for Linux, since the multithreading issues described for |
284 | | -// // example here: |
285 | | -// // http://forum.jogamp.org/QtJambi-JOGL-Ubuntu-Lucid-td909554.html |
286 | | -// // have not been solved yet (at least for stable release b32 of JOGL2). |
287 | | -// GLProfile.initSingleton(false); |
288 | | -// } else { |
289 | | -// GLProfile.initSingleton(true); |
290 | | -// } |
291 | | -// } |
292 | | - |
293 | 277 | canvas = new Canvas(); |
294 | | - pg.parent.add(canvas); |
295 | 278 |
|
296 | 279 | canvas.setBounds(0, 0, pg.parent.width, pg.parent.height); |
297 | 280 | canvas.setFocusable(true); |
298 | 281 | canvas.requestFocus(); |
299 | | - canvas.setIgnoreRepaint(true); |
| 282 | + canvas.setIgnoreRepaint(true); |
| 283 | + pg.parent.setLayout(new BorderLayout()); |
| 284 | + pg.parent.add(canvas, BorderLayout.CENTER); |
300 | 285 |
|
301 | 286 | try { |
302 | 287 | Display.setParent(canvas); |
303 | 288 | PixelFormat format = new PixelFormat(32, 0, 24, 8, antialias); |
304 | 289 | Display.create(format); |
305 | | - Display.setVSyncEnabled(false); |
| 290 | + Display.setVSyncEnabled(false); |
306 | 291 | } catch (LWJGLException e) { |
307 | 292 | e.printStackTrace(); |
308 | 293 | } |
| 294 | + |
| 295 | + canvas.addMouseListener(pg.parent); |
| 296 | + canvas.addMouseMotionListener(pg.parent); |
| 297 | + canvas.addKeyListener(pg.parent); |
| 298 | + canvas.addFocusListener(pg.parent); |
309 | 299 |
|
310 | 300 | initialized = true; |
311 | 301 | } |
|
0 commit comments