From 4edf23428def9d12e3cd8a7e39a7be48b0251a99 Mon Sep 17 00:00:00 2001 From: Ioannis Tsakpinis Date: Fri, 14 Oct 2011 10:43:45 +0000 Subject: [PATCH] Updated GLES FullScreenWindowedTest to destroy/create Display on mode change. --- src/java/org/lwjgl/opengl/DrawableGLES.java | 2 +- src/java/org/lwjgl/opengles/EGLDisplay.java | 2 +- .../test/opengles/FullScreenWindowedTest.java | 21 +++++++++++-------- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/java/org/lwjgl/opengl/DrawableGLES.java b/src/java/org/lwjgl/opengl/DrawableGLES.java index eadc1054..1b29e7ad 100644 --- a/src/java/org/lwjgl/opengl/DrawableGLES.java +++ b/src/java/org/lwjgl/opengl/DrawableGLES.java @@ -101,7 +101,7 @@ abstract class DrawableGLES implements DrawableLWJGL { throw new LWJGLException("No EGLConfigs found for the specified PixelFormat."); final EGLConfig eglConfig = pf.getBestMatch(configs); - final EGLSurface eglSurface = eglDisplay.createWindowSurface(eglConfig, (int)window, null); + final EGLSurface eglSurface = eglDisplay.createWindowSurface(eglConfig, window, null); pf.setSurfaceAttribs(eglSurface); this.eglDisplay = eglDisplay; diff --git a/src/java/org/lwjgl/opengles/EGLDisplay.java b/src/java/org/lwjgl/opengles/EGLDisplay.java index fe49e25d..5e6016f1 100644 --- a/src/java/org/lwjgl/opengles/EGLDisplay.java +++ b/src/java/org/lwjgl/opengles/EGLDisplay.java @@ -172,7 +172,7 @@ public final class EGLDisplay extends PointerWrapperAbstract { * * @return the EGL surface */ - public EGLSurface createWindowSurface(EGLConfig config, int window, IntBuffer attrib_list) throws LWJGLException { + public EGLSurface createWindowSurface(EGLConfig config, long window, IntBuffer attrib_list) throws LWJGLException { checkInitialized(); if ( config.getDisplay() != this ) diff --git a/src/java/org/lwjgl/test/opengles/FullScreenWindowedTest.java b/src/java/org/lwjgl/test/opengles/FullScreenWindowedTest.java index 59c1bd67..b674f49c 100644 --- a/src/java/org/lwjgl/test/opengles/FullScreenWindowedTest.java +++ b/src/java/org/lwjgl/test/opengles/FullScreenWindowedTest.java @@ -82,7 +82,6 @@ public class FullScreenWindowedTest { initialize(); mainLoop(); cleanup(); - Display.destroy(); } private void switchMode() throws LWJGLException { @@ -99,18 +98,22 @@ public class FullScreenWindowedTest { try { //find displaymode switchMode(); - // start of in windowed mode - Display.create(new PixelFormat()); - glInit(); + quadPosition = new Vector2f(100f, 100f); quadVelocity = new Vector2f(1.0f, 1.0f); - renderer = new QuadRenderer(); + reinit(); } catch (Exception e) { e.printStackTrace(); } } + private void reinit() throws LWJGLException { + Display.create(new PixelFormat()); + glInit(); + renderer = new QuadRenderer(); + } + /** Runs the main loop of the "test" */ private void mainLoop() { while ( !Keyboard.isKeyDown(Keyboard.KEY_ESCAPE) && !Display.isCloseRequested() ) { @@ -185,8 +188,7 @@ public class FullScreenWindowedTest { switchMode(); - glInit(); - renderer = new QuadRenderer(); + reinit(); } catch (Exception e) { e.printStackTrace(); } @@ -199,8 +201,7 @@ public class FullScreenWindowedTest { mode = new DisplayMode(800, 480); Display.setDisplayModeAndFullscreen(mode); - glInit(); - renderer = new QuadRenderer(); + reinit(); } catch (Exception e) { e.printStackTrace(); } @@ -254,6 +255,8 @@ public class FullScreenWindowedTest { int_buffer.put(1, indices_buffer_id); glDeleteBuffers(int_buffer); + + Display.destroy(); } /**