diff options
author | Sven Gothel <[email protected]> | 2011-11-19 19:32:27 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-11-19 19:32:27 +0100 |
commit | cc63a4689c3a6456fb616341c19eb4f0d0ab722a (patch) | |
tree | 858e70d21528ac1327a2c685f4ad86669e4d88d0 /src/test | |
parent | 8a985f8652151684063853f61e479d75d8203f07 (diff) |
Demo: GearsES1/ES2 visualize focus
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/GearsES1.java | 15 | ||||
-rw-r--r-- | src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java | 4 |
2 files changed, 16 insertions, 3 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/GearsES1.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/GearsES1.java index 8d579ce5d..b5a729e02 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/GearsES1.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/GearsES1.java @@ -21,6 +21,7 @@ package com.jogamp.opengl.test.junit.jogl.demos.es1; +import javax.media.nativewindow.NativeWindow; import javax.media.opengl.GL; import javax.media.opengl.GL2ES1; import javax.media.opengl.GLAutoDrawable; @@ -181,8 +182,18 @@ public class GearsES1 implements GLEventListener { // Get the GL corresponding to the drawable we are animating GL2ES1 gl = drawable.getGL().getGL2ES1(); - gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); - + final boolean hasFocus; + if(drawable.getNativeSurface() instanceof NativeWindow) { + hasFocus = ((NativeWindow)drawable.getNativeSurface()).hasFocus(); + } else { + hasFocus = true; + } + if(hasFocus) { + gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); + } else { + gl.glClearColor(0.2f, 0.2f, 0.2f, 0.0f); + } + // Special handling for the case where the GLJPanel is translucent // and wants to be composited with other Java 2D content if (GLProfile.isAWTAvailable() && diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java index 63bbab66e..51bc7d137 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java @@ -246,9 +246,11 @@ public class GearsES2 implements GLEventListener { // Get the GL corresponding to the drawable we are animating GL2ES2 gl = drawable.getGL().getGL2ES2(); - boolean hasFocus = false; + final boolean hasFocus; if(drawable.getNativeSurface() instanceof NativeWindow) { hasFocus = ((NativeWindow)drawable.getNativeSurface()).hasFocus(); + } else { + hasFocus = true; } if(hasFocus) { gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); |