summaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/javax/media/opengl/awt
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2010-06-26 06:59:48 +0300
committerSven Gothel <[email protected]>2010-06-26 06:59:48 +0300
commit969e427642d3b9be376cefaada9febd489b7b3d7 (patch)
treed2b4af8b500c0f561fc9d77807f318959ef41b4b /src/jogl/classes/javax/media/opengl/awt
parentce8c373576fe58fa5c71811fa376321e5379f71d (diff)
GLAutoDrawable: setAnimator/getAnimator/invoke/display changes; NEWT: Adding native repaint; NewtCanvasAWT focus fix
Support for native repaint, which shall call display() in case no animator is running. GLAutoDrawable invoke(GLRunnable) impl. handles case if invoked on animator thread, or no animator thread is running (issueing a display() call). The impl resides in GLDrawableHelper. GLEventListener's init() and glViewport()/reshape() method must be called before the 1st display() and after a dispose() call. It could miss the 1st display() call if added after the setVisible(true) call - due to the native repainting. The impl resides in GLDrawableHelper. The Animator un-/registers itself at the GLAutoDrawable via setAnimator. NEWT Window reparent always issues a resize() and display() call. NEWT native Window uses direct send.*Event for input events (again), instead of enqueueing it for performance. NEWT Window implements all status change and Java native event callbacks, instead of having duplicated code in all implementations. NewtCanvasAWT if the Newt window is focused, the AWT/Swing component[s] will loose the focus.
Diffstat (limited to 'src/jogl/classes/javax/media/opengl/awt')
-rw-r--r--src/jogl/classes/javax/media/opengl/awt/GLCanvas.java19
-rw-r--r--src/jogl/classes/javax/media/opengl/awt/GLJPanel.java13
2 files changed, 23 insertions, 9 deletions
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
index 2dafd691a..f150b2507 100644
--- a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
+++ b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
@@ -378,7 +378,9 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable {
return;
}
- display();
+ if( null == getAnimator() ) {
+ display();
+ }
}
/** Overridden to track when this component is added to a container.
@@ -492,8 +494,16 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable {
drawableHelper.removeGLEventListener(listener);
}
+ public void setAnimator(Thread animator) {
+ drawableHelper.setAnimator(animator);
+ }
+
+ public Thread getAnimator() {
+ return drawableHelper.getAnimator();
+ }
+
public void invoke(boolean wait, GLRunnable glRunnable) {
- drawableHelper.invoke(wait, glRunnable);
+ drawableHelper.invoke(this, wait, glRunnable);
}
public void setContext(GLContext ctx) {
@@ -640,10 +650,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable {
if (sendReshape) {
// Note: we ignore the given x and y within the parent component
// since we are drawing directly into this heavyweight component.
- int width = getWidth();
- int height = getHeight();
- getGL().glViewport(0, 0, width, height);
- drawableHelper.reshape(GLCanvas.this, 0, 0, width, height);
+ drawableHelper.reshape(GLCanvas.this, 0, 0, getWidth(), getHeight());
sendReshape = false;
}
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
index 73962e979..d0d97fe31 100644
--- a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
+++ b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
@@ -380,8 +380,16 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable {
drawableHelper.removeGLEventListener(listener);
}
+ public void setAnimator(Thread animator) {
+ drawableHelper.setAnimator(animator);
+ }
+
+ public Thread getAnimator() {
+ return drawableHelper.getAnimator();
+ }
+
public void invoke(boolean wait, GLRunnable glRunnable) {
- drawableHelper.invoke(wait, glRunnable);
+ drawableHelper.invoke(this, wait, glRunnable);
}
public GLContext createContext(GLContext shareWith) {
@@ -585,9 +593,8 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable {
}
if (sendReshape) {
if (DEBUG||VERBOSE) {
- System.err.println("display: glViewport(" + viewportX + "," + viewportY + " " + panelWidth + "x" + panelHeight + ")");
+ System.err.println("display: reshape(" + viewportX + "," + viewportY + " " + panelWidth + "x" + panelHeight + ")");
}
- getGL().getGL2().glViewport(viewportX, viewportY, panelWidth, panelHeight);
drawableHelper.reshape(GLJPanel.this, viewportX, viewportY, panelWidth, panelHeight);
sendReshape = false;
}