mirror of
https://github.com/shadowfacts/lwjgl2-arm64.git
synced 2026-04-04 22:17:59 +00:00
Moved BaseGL constructor parameters to Display
This commit is contained in:
parent
f7521462ff
commit
1f3f00aed1
14 changed files with 171 additions and 153 deletions
|
|
@ -81,12 +81,18 @@ public final class Display {
|
|||
* destroyed.
|
||||
*
|
||||
* @param displayMode a display mode to choose
|
||||
* @param alpha_bits number of alpha bits required
|
||||
* @param depth_bits number of depth bits required
|
||||
* @param stencil_bits number of stencil bits required
|
||||
* @param fullscreen whether to create the display fullscreen
|
||||
* @throws Exception if the display mode could not be set
|
||||
* @see #destroy()
|
||||
*/
|
||||
public static void create(
|
||||
DisplayMode displayMode,
|
||||
int alpha_bits,
|
||||
int depth_bits,
|
||||
int stencil_bits,
|
||||
boolean fullscreen)
|
||||
throws Exception {
|
||||
|
||||
|
|
@ -97,6 +103,9 @@ public final class Display {
|
|||
displayMode.height,
|
||||
displayMode.bpp,
|
||||
displayMode.freq,
|
||||
alpha_bits,
|
||||
depth_bits,
|
||||
stencil_bits,
|
||||
fullscreen))
|
||||
throw new Exception("Failed to set display mode to " + displayMode);
|
||||
|
||||
|
|
@ -115,6 +124,9 @@ public final class Display {
|
|||
int height,
|
||||
int bpp,
|
||||
int freq,
|
||||
int alpha_bits,
|
||||
int depth_bits,
|
||||
int stencil_bits,
|
||||
boolean fullscreen);
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -68,33 +68,13 @@ abstract class BaseGL {
|
|||
/** This GL will be valid for use in only one thread */
|
||||
protected Thread renderThread;
|
||||
|
||||
/** The number of color bits */
|
||||
protected final int colorBits;
|
||||
|
||||
/** The number of alpha bits */
|
||||
protected final int alphaBits;
|
||||
|
||||
/** The number of depth bits */
|
||||
protected final int depthBits;
|
||||
|
||||
/** The number of stencil bits */
|
||||
protected final int stencilBits;
|
||||
|
||||
/**
|
||||
* Constructor for BaseGL. The context is not created at this point;
|
||||
* to create the GL you must call create().
|
||||
*
|
||||
* @param colorBits the number of color bits (eg. 16, 24, 32)
|
||||
* @param alphaBits the number of alpha bits (eg. 0 or 8)
|
||||
* @param depthBits the number of depth bits (eg. 16 or 24)
|
||||
* @param stencilBits the number of stencil bits (eg. 0 or 8)
|
||||
* @see #create()
|
||||
*/
|
||||
public BaseGL(int colorBits, int alphaBits, int depthBits, int stencilBits) {
|
||||
this.colorBits = colorBits;
|
||||
this.alphaBits = alphaBits;
|
||||
this.depthBits = depthBits;
|
||||
this.stencilBits = stencilBits;
|
||||
public BaseGL() {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -106,7 +86,7 @@ abstract class BaseGL {
|
|||
public final void create() throws Exception{
|
||||
if (created)
|
||||
return;
|
||||
if (!nCreate(colorBits, alphaBits, depthBits, stencilBits))
|
||||
if (!nCreate())
|
||||
throw new Exception("GL could not be created.");
|
||||
created = true;
|
||||
makeCurrent();
|
||||
|
|
@ -127,7 +107,7 @@ abstract class BaseGL {
|
|||
* @return true if the GL was created successfully
|
||||
* @see org.lwjgl.Display#create(org.lwjgl.DisplayMode, boolean)
|
||||
*/
|
||||
private native boolean nCreate(int colorBits, int alphaBits, int depthBits, int stencilBits);
|
||||
private native boolean nCreate();
|
||||
|
||||
/**
|
||||
* Destroy the GL context. Does nothing if the GL has not yet been created.
|
||||
|
|
|
|||
|
|
@ -45,12 +45,8 @@ public class CoreGL extends BaseGL implements CoreGLConstants {
|
|||
/**
|
||||
* Constructor for CoreGL.
|
||||
*/
|
||||
public CoreGL(
|
||||
int colorBits,
|
||||
int alphaBits,
|
||||
int depthBits,
|
||||
int stencilBits) {
|
||||
super(colorBits, alphaBits, depthBits, stencilBits);
|
||||
public CoreGL() {
|
||||
super();
|
||||
}
|
||||
|
||||
public native void accum(int op, float value);
|
||||
|
|
|
|||
|
|
@ -1535,8 +1535,8 @@ public class GL extends CoreGL implements GLConstants {
|
|||
/**
|
||||
* Constructor for GL.
|
||||
*/
|
||||
public GL(int colorBits, int alphaBits, int depthBits, int stencilBits) {
|
||||
super(colorBits, alphaBits, depthBits, stencilBits);
|
||||
public GL() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ public final class Game {
|
|||
for (int i = 0; i < modes.length; i ++)
|
||||
System.out.println(modes[i]);
|
||||
// For now let's just pick a mode we're certain to have
|
||||
Display.create(new DisplayMode(640, 480, 16, 60), true);
|
||||
Display.create(new DisplayMode(640, 480, 16, 60), 8, 16, 0, true);
|
||||
System.out.println("Created display.");
|
||||
} catch (Exception e) {
|
||||
System.err.println("Failed to create display due to "+e);
|
||||
|
|
@ -63,7 +63,7 @@ public final class Game {
|
|||
}
|
||||
}
|
||||
|
||||
public static final GL gl = new GL(16, 0, 16, 8);
|
||||
public static final GL gl = new GL();
|
||||
public static final GLU glu = new GLU(gl);
|
||||
static {
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ public class Grass {
|
|||
for (int i = 0; i < modes.length; i ++)
|
||||
System.out.println(modes[i]);
|
||||
// For now let's just pick a mode we're certain to have
|
||||
Display.create(new DisplayMode(800, 600, 16, 60), false);
|
||||
Display.create(new DisplayMode(800, 600, 16, 60), 8, 16, 0, false);
|
||||
System.out.println("Created display.");
|
||||
} catch (Exception e) {
|
||||
System.err.println("Failed to create display due to "+e);
|
||||
|
|
@ -34,7 +34,7 @@ public class Grass {
|
|||
}
|
||||
}
|
||||
|
||||
public static final GL gl = new GL(16, 0, 16, 8);
|
||||
public static final GL gl = new GL();
|
||||
public static final GLU glu = new GLU(gl);
|
||||
static {
|
||||
try {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue