|
From: <sp...@us...> - 2011-07-10 17:45:50
|
Revision: 3562
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3562&view=rev
Author: spasi
Date: 2011-07-10 17:45:43 +0000 (Sun, 10 Jul 2011)
Log Message:
-----------
Replaced Display.createES() with Display.create(ContextType.GLES).
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java
Added Paths:
-----------
trunk/LWJGL/src/java/org/lwjgl/opengl/ContextType.java
Added: trunk/LWJGL/src/java/org/lwjgl/opengl/ContextType.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/ContextType.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/ContextType.java 2011-07-10 17:45:43 UTC (rev 3562)
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2002-2011 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengl;
+
+/**
+ * This enum can be used in the default Display.create method to specify
+ * the context type that will be created.
+ *
+ * @author Spasi
+ */
+public enum ContextType {
+
+ GL,
+ GLES,
+
+}
\ No newline at end of file
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java 2011-07-10 16:58:16 UTC (rev 3561)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java 2011-07-10 17:45:43 UTC (rev 3562)
@@ -730,7 +730,7 @@
}
/**
- * Create the OpenGL context. If isFullscreen() is true or if windowed
+ * Create the Display with the specified context type. If isFullscreen() is true or if windowed
* context are not supported on the platform, the display mode will be switched to the mode returned by
* getDisplayMode(), and a fullscreen context will be created. If isFullscreen() is false, a windowed context
* will be created with the dimensions given in the mode returned by getDisplayMode(). If a context can't be
@@ -738,15 +738,39 @@
* <p/>
* <p>The window created will be set up in orthographic 2D projection, with 1:1 pixel ratio with GL coordinates.
*
+ * @param type the context type to create
+ *
* @throws LWJGLException
*/
- public static void create() throws LWJGLException {
+ public static void create(ContextType type) throws LWJGLException {
synchronized ( GlobalLock.lock ) {
- create(new PixelFormat());
+ switch ( type ) {
+ case GL:
+ create(new PixelFormat());
+ break;
+ case GLES:
+ create(new org.lwjgl.opengles.PixelFormat());
+ break;
+ }
}
}
/**
+ * Create the OpenGL context. If isFullscreen() is true or if windowed
+ * context are not supported on the platform, the display mode will be switched to the mode returned by
+ * getDisplayMode(), and a fullscreen context will be created. If isFullscreen() is false, a windowed context
+ * will be created with the dimensions given in the mode returned by getDisplayMode(). If a context can't be
+ * created with the given parameters, a LWJGLException will be thrown.
+ * <p/>
+ * <p>The window created will be set up in orthographic 2D projection, with 1:1 pixel ratio with GL coordinates.
+ *
+ * @throws LWJGLException
+ */
+ public static void create() throws LWJGLException {
+ create(ContextType.GL);
+ }
+
+ /**
* Create the OpenGL context with the given minimum parameters. If isFullscreen() is true or if windowed
* context are not supported on the platform, the display mode will be switched to the mode returned by
* getDisplayMode(), and a fullscreen context will be created. If isFullscreen() is false, a windowed context
@@ -878,23 +902,6 @@
}
/**
- * Create the OpenGL ES context. If isFullscreen() is true or if windowed
- * context are not supported on the platform, the display mode will be switched to the mode returned by
- * getDisplayMode(), and a fullscreen context will be created. If isFullscreen() is false, a windowed context
- * will be created with the dimensions given in the mode returned by getDisplayMode(). If a context can't be
- * created with the given parameters, a LWJGLException will be thrown.
- * <p/>
- * <p>The window created will be set up in orthographic 2D projection, with 1:1 pixel ratio with GL coordinates.
- *
- * @throws LWJGLException
- */
- public static void createES() throws LWJGLException {
- synchronized ( GlobalLock.lock ) {
- create(new org.lwjgl.opengles.PixelFormat());
- }
- }
-
- /**
* Create the OpenGL ES context with the given minimum parameters. If isFullscreen() is true or if windowed
* context are not supported on the platform, the display mode will be switched to the mode returned by
* getDisplayMode(), and a fullscreen context will be created. If isFullscreen() is false, a windowed context
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|