Replaced Display.createES() with Display.create(ContextType.GLES).

This commit is contained in:
Ioannis Tsakpinis 2011-07-10 17:45:43 +00:00
parent 6c134c6330
commit f1fee0624b
2 changed files with 72 additions and 20 deletions

View File

@ -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,
}

View File

@ -729,6 +729,32 @@ public final class Display {
});
}
/**
* 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
* 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.
*
* @param type the context type to create
*
* @throws LWJGLException
*/
public static void create(ContextType type) throws LWJGLException {
synchronized ( GlobalLock.lock ) {
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
@ -741,9 +767,7 @@ public final class Display {
* @throws LWJGLException
*/
public static void create() throws LWJGLException {
synchronized ( GlobalLock.lock ) {
create(new PixelFormat());
}
create(ContextType.GL);
}
/**
@ -877,23 +901,6 @@ public final class Display {
}
}
/**
* 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