|
2 | 2 |
|
3 | 3 | import java.awt.Canvas; |
4 | 4 | import java.awt.Color; |
| 5 | +import java.awt.Component; |
5 | 6 | import java.awt.EventQueue; |
6 | 7 | import java.awt.Frame; |
7 | 8 | import java.awt.Rectangle; |
@@ -60,24 +61,26 @@ public class PSurfaceJOGL implements PSurface { |
60 | 61 | Throwable drawException; |
61 | 62 | Object waitObject = new Object(); |
62 | 63 |
|
| 64 | + NewtCanvasAWT canvas; |
| 65 | + |
| 66 | + |
63 | 67 | public PSurfaceJOGL(PGraphics graphics) { |
64 | 68 | this.graphics = graphics; |
65 | 69 | this.pgl = (PJOGL) ((PGraphicsOpenGL)graphics).pgl; |
66 | 70 | } |
67 | 71 |
|
68 | | - public void initOffscreen() { |
| 72 | + public void initOffscreen(PApplet sketch) { |
69 | 73 | // TODO Auto-generated method stub |
70 | | - |
71 | 74 | } |
72 | 75 |
|
73 | | - public Canvas initCanvas(PApplet sketch) { |
| 76 | + public Canvas initComponent(PApplet sketch) { |
74 | 77 | this.sketch = sketch; |
75 | 78 |
|
76 | 79 | sketchWidth = sketch.sketchWidth(); |
77 | 80 | sketchHeight = sketch.sketchHeight(); |
78 | 81 |
|
79 | 82 | if (window != null) { |
80 | | - NewtCanvasAWT canvas = new NewtCanvasAWT(window); |
| 83 | + canvas = new NewtCanvasAWT(window); |
81 | 84 | canvas.setBounds(0, 0, window.getWidth(), window.getHeight()); |
82 | 85 | // canvas.setBackground(new Color(pg.backgroundColor, true)); |
83 | 86 | canvas.setFocusable(true); |
@@ -424,6 +427,10 @@ public void setSize(int width, int height) { |
424 | 427 | } |
425 | 428 | } |
426 | 429 |
|
| 430 | + public Component getComponent() { |
| 431 | + return canvas; |
| 432 | + } |
| 433 | + |
427 | 434 | public void setSmooth(int level) { |
428 | 435 | pgl.reqNumSamples = level; |
429 | 436 | GLCapabilities caps = new GLCapabilities(profile); |
@@ -453,10 +460,6 @@ public void requestFocus() { |
453 | 460 |
|
454 | 461 | } |
455 | 462 |
|
456 | | - public void blit() { |
457 | | - // TODO Auto-generated method stub |
458 | | - } |
459 | | - |
460 | 463 | class DrawListener implements GLEventListener { |
461 | 464 | public void display(GLAutoDrawable drawable) { |
462 | 465 | pgl.getGL(drawable); |
|
0 commit comments