*** empty log message ***

This commit is contained in:
Elias Naur 2003-08-04 10:09:40 +00:00
parent df0866d4fb
commit d359a6b7e1
23 changed files with 1141 additions and 1132 deletions

View file

@ -4,7 +4,7 @@
* To change this generated comment go to
* Window>Preferences>Java>Code Generation>Code Template
*/
package org.lwjgl;
package org.lwjgl.opengl;
/**
* This is the abstract class for a Window in LWJGL. LWJGL windows have some
@ -20,6 +20,10 @@ package org.lwjgl;
*
* @author foo
*/
import org.lwjgl.Display;
import org.lwjgl.Sys;
public final class Window {
static {
@ -29,18 +33,6 @@ public final class Window {
/** Whether the window is currently created, ie. has a native peer */
private static boolean created;
/** Whether the window is currently minimized */
private static boolean minimized;
/** Whether the window has focus */
private static boolean focused = true;
/** Whether the window has been asked to close by the user or underlying OS */
private static boolean closeRequested;
/** Whether the window is dirty, ie. needs painting */
private static boolean dirty;
/** X coordinate of the window */
private static int x;
@ -142,28 +134,31 @@ public final class Window {
*/
public static boolean isCloseRequested() {
assert isCreated();
boolean currentValue = closeRequested;
closeRequested = false;
return currentValue;
return nIsCloseRequested();
}
private static native boolean nIsCloseRequested();
/**
* @return true if the window is minimized or otherwise not visible
*/
public static boolean isMinimized() {
assert isCreated();
return minimized;
return nIsMinimized();
}
private static native boolean nIsMinimized();
/**
* @return true if window is focused
*/
public static boolean isFocused() {
assert isCreated();
return focused;
return nIsFocused();
}
private static native boolean nIsFocused();
/**
* Minimize the game and allow the operating system's default display to become
* visible. It is the responsibility of LWJGL's native code to restore the display
@ -193,15 +188,16 @@ public final class Window {
*/
public static boolean isDirty() {
assert isCreated();
return dirty;
return nIsDirty();
}
private static native boolean nIsDirty();
/**
* Paint the window. This clears the dirty flag and swaps the buffers.
*/
public static void paint() {
assert isCreated();
dirty = false;
swapBuffers();
}

View file

@ -7,7 +7,7 @@
package org.lwjgl.test;
import org.lwjgl.*;
import org.lwjgl.opengl.GLWindow;
import org.lwjgl.opengl.Window;
/**
* @author Brian
@ -15,14 +15,11 @@ import org.lwjgl.opengl.GLWindow;
public class WindowCreationTest {
public static void main(String[] args) {
GLWindow gl = null;
DisplayMode[] modes = Display.getAvailableDisplayModes();
System.out.println("Found " + modes.length + " display modes");
try {
gl = new GLWindow("WindowCreationTest", 50, 50, 320, 240, 16, 0, 0, 0);
gl.create();
Window.create("WindowCreationTest", 50, 50, 320, 240, 16, 0, 0, 0);
} catch (Exception e) {
e.printStackTrace();
}
@ -38,6 +35,6 @@ public class WindowCreationTest {
}
}
gl.destroy();
Window.destroy();
}
}

View file

@ -34,10 +34,9 @@ package org.lwjgl.test.input;
import org.lwjgl.Sys;
import org.lwjgl.Display;
import org.lwjgl.DisplayMode;
import org.lwjgl.Window;
import org.lwjgl.input.Controller;
import org.lwjgl.opengl.GL;
import org.lwjgl.opengl.GLWindow;
import org.lwjgl.opengl.Window;
import org.lwjgl.opengl.GLU;
import org.lwjgl.vector.Vector2f;
@ -50,10 +49,6 @@ import org.lwjgl.vector.Vector2f;
* @version $Revision$
*/
public class ControllerCreationTest {
/** OpenGL instance */
private GLWindow gl;
/** position of quad to draw */
private Vector2f position = new Vector2f(320.0f, 240.0f);
@ -79,11 +74,10 @@ public class ControllerCreationTest {
try {
if(fullscreen) {
Display.setDisplayMode(displayMode);
gl = new GLWindow("ControllerCreationTest", 16, 0, 0, 0);
Window.create("ControllerCreationTest", 16, 0, 0, 0);
} else {
gl = new GLWindow("ControllerCreationTest", 50, 50, 640, 480, 16, 0, 0, 0);
Window.create("ControllerCreationTest", 50, 50, 640, 480, 16, 0, 0, 0);
}
gl.create();
} catch (Exception e) {
e.printStackTrace();
@ -115,12 +109,12 @@ public class ControllerCreationTest {
// recreate display in fullscreen mode
System.out.print("Destroying display...");
gl.destroy();
Window.destroy();
System.out.println("success");
System.out.print("Entering fullscreen mode...");
try {
gl.destroy();
Window.destroy();
initialize(true);
Display.setDisplayMode(displayMode);
} catch (Exception e) {
@ -143,7 +137,7 @@ public class ControllerCreationTest {
System.out.print("Shutting down...");
Display.resetDisplayMode();
Controller.destroy();
gl.destroy();
Window.destroy();
System.out.println("shutdown complete");
}

View file

@ -32,11 +32,10 @@
package org.lwjgl.test.input;
import org.lwjgl.DisplayMode;
import org.lwjgl.Window;
import org.lwjgl.input.Controller;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL;
import org.lwjgl.opengl.GLWindow;
import org.lwjgl.opengl.Window;
import org.lwjgl.opengl.GLU;
import org.lwjgl.vector.Vector2f;
@ -50,9 +49,6 @@ import org.lwjgl.vector.Vector2f;
*/
public class ControllerTest {
/** OpenGL instance */
private GLWindow gl;
/** GLU instance */
private GLU glu;
@ -80,8 +76,7 @@ public class ControllerTest {
private void setupDisplay(boolean fullscreen) {
try {
gl = new GLWindow("ControllerTest", 50, 50, 640, 480, 16, 0, 0, 0);
gl.create();
Window.create("ControllerTest", 50, 50, 640, 480, 16, 0, 0, 0);
} catch (Exception e) {
e.printStackTrace();
System.exit(-1);
@ -104,7 +99,7 @@ public class ControllerTest {
Controller.destroy();
Keyboard.destroy();
gl.destroy();
Window.destroy();
}
private void createController() {

View file

@ -50,9 +50,6 @@ public class HWCursorTest {
/** Intended deiplay mode */
private DisplayMode mode;
/** GL instance */
private GLWindow gl;
/** GLU instance */
private GLU glu;
@ -83,8 +80,7 @@ public class HWCursorTest {
mode = findDisplayMode(800, 600, 16);
// start of in windowed mode
gl = new GLWindow("Test", 50, 50, mode.width, mode.height, mode.bpp, 0, 0, 0);
gl.create();
Window.create("Test", 50, 50, mode.width, mode.height, mode.bpp, 0, 0, 0);
glInit();
@ -230,11 +226,10 @@ public class HWCursorTest {
}
cursor.destroy();
Mouse.destroy();
gl.destroy();
Window.destroy();
Display.setDisplayMode(mode);
gl = new GLWindow("Test", mode.bpp, 0, 0, 0);
gl.create();
Window.create("Test", mode.bpp, 0, 0, 0);
glInit();
@ -257,11 +252,10 @@ public class HWCursorTest {
}
cursor.destroy();
Mouse.destroy();
gl.destroy();
Window.destroy();
Display.resetDisplayMode();
gl = new GLWindow("Test", 50, 50, mode.width, mode.height, mode.bpp, 0, 0, 0);
gl.create();
Window.create("Test", 50, 50, mode.width, mode.height, mode.bpp, 0, 0, 0);
glInit();
@ -304,7 +298,7 @@ public class HWCursorTest {
cursor.destroy();
Mouse.destroy();
Display.resetDisplayMode();
gl.destroy();
Window.destroy();
}
/**

View file

@ -32,10 +32,9 @@
package org.lwjgl.test.input;
import org.lwjgl.DisplayMode;
import org.lwjgl.Window;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL;
import org.lwjgl.opengl.GLWindow;
import org.lwjgl.opengl.Window;
import org.lwjgl.opengl.GLU;
import org.lwjgl.vector.Vector2f;
@ -49,9 +48,6 @@ import org.lwjgl.vector.Vector2f;
*/
public class KeyboardTest {
/** OpenGL instance */
private GLWindow gl;
/** GLU instance */
private GLU glu;
@ -83,9 +79,7 @@ public class KeyboardTest {
private void setupDisplay(boolean fullscreen) {
try {
gl = new GLWindow("KeyboardTest", 50, 50, 640, 480, 16, 0, 0, 0);
gl.create();
Window.create("KeyboardTest", 50, 50, 640, 480, 16, 0, 0, 0);
} catch (Exception e) {
e.printStackTrace();
System.exit(-1);
@ -107,7 +101,7 @@ public class KeyboardTest {
wiggleKeyboard();
Keyboard.destroy();
gl.destroy();
Window.destroy();
}
private void createKeyboard() {

View file

@ -34,10 +34,9 @@ package org.lwjgl.test.input;
import org.lwjgl.Sys;
import org.lwjgl.Display;
import org.lwjgl.DisplayMode;
import org.lwjgl.Window;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL;
import org.lwjgl.opengl.GLWindow;
import org.lwjgl.opengl.Window;
import org.lwjgl.opengl.GLU;
import org.lwjgl.vector.Vector2f;
@ -50,10 +49,6 @@ import org.lwjgl.vector.Vector2f;
* @version $Revision$
*/
public class MouseCreationTest {
/** OpenGL instance */
private GLWindow gl;
/** GLU instance */
private GLU glu;
@ -82,11 +77,10 @@ public class MouseCreationTest {
try {
if(fullscreen) {
Display.setDisplayMode(displayMode);
gl = new GLWindow("MouseCreationTest", 16, 0, 0, 0);
Window.create("MouseCreationTest", 16, 0, 0, 0);
} else {
gl = new GLWindow("MouseCreationTest", 50, 50, 640, 480, 16, 0, 0, 0);
Window.create("MouseCreationTest", 50, 50, 640, 480, 16, 0, 0, 0);
}
gl.create();
} catch (Exception e) {
e.printStackTrace();
@ -123,7 +117,7 @@ public class MouseCreationTest {
System.out.print("Entering fullscreen mode...");
try {
gl.destroy();
Window.destroy();
initialize(true);
Display.setDisplayMode(displayMode);
} catch (Exception e) {
@ -146,7 +140,7 @@ public class MouseCreationTest {
System.out.print("Shutting down...");
Display.resetDisplayMode();
Mouse.destroy();
gl.destroy();
Window.destroy();
System.out.println("shutdown complete");
}

View file

@ -32,11 +32,10 @@
package org.lwjgl.test.input;
import org.lwjgl.DisplayMode;
import org.lwjgl.Window;
import org.lwjgl.input.Mouse;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL;
import org.lwjgl.opengl.GLWindow;
import org.lwjgl.opengl.Window;
import org.lwjgl.opengl.GLU;
import org.lwjgl.vector.Vector2f;
@ -50,9 +49,6 @@ import org.lwjgl.vector.Vector2f;
*/
public class MouseTest {
/** OpenGL instance */
private GLWindow gl;
/** GLU instance */
private GLU glu;
@ -80,9 +76,7 @@ public class MouseTest {
private void setupDisplay(boolean fullscreen) {
try {
gl = new GLWindow("MouseTest", 50, 50, 640, 480, 16, 0, 0, 0);
gl.create();
Window.create("MouseTest", 50, 50, 640, 480, 16, 0, 0, 0);
} catch (Exception e) {
e.printStackTrace();
System.exit(-1);
@ -105,7 +99,7 @@ public class MouseTest {
Mouse.destroy();
Keyboard.destroy();
gl.destroy();
Window.destroy();
}
private void createMouse() {

View file

@ -31,11 +31,10 @@
*/
package org.lwjgl.test.openal;
import org.lwjgl.Window;
import org.lwjgl.openal.AL;
import org.lwjgl.openal.eax.*;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GLWindow;
import org.lwjgl.opengl.Window;
import java.nio.IntBuffer;
import java.nio.FloatBuffer;
@ -52,7 +51,6 @@ import java.nio.FloatBuffer;
public class MovingSoundTest extends BasicTest {
public static float MOVEMENT = 50.00f;
private GLWindow gl = new GLWindow("Moving Sound Test", 100, 100, 320, 240, 32, 0 ,0 ,0);
/**
* Creates an instance of MovingSoundTest
@ -71,7 +69,7 @@ public class MovingSoundTest extends BasicTest {
}
try {
gl.create();
Window.create("Moving Sound Test", 100, 100, 320, 240, 32, 0 ,0 ,0);
} catch (Exception e) {
e.printStackTrace();
}

View file

@ -49,9 +49,6 @@ public class FullScreenWindowedTest {
/** Intended deiplay mode */
private DisplayMode mode;
/** GL instance */
private GLWindow gl;
/** GLU instance */
private GLU glu;
@ -96,8 +93,7 @@ public class FullScreenWindowedTest {
mode = findDisplayMode(800, 600, 16);
// start of in windowed mode
gl = new GLWindow("Test", 50, 50, mode.width, mode.height, mode.bpp, 0, 0, 0);
gl.create();
Window.create("Test", 50, 50, mode.width, mode.height, mode.bpp, 0, 0, 0);
glInit();
@ -202,11 +198,10 @@ public class FullScreenWindowedTest {
try {
Keyboard.destroy();
gl.destroy();
Window.destroy();
Display.setDisplayMode(mode);
gl = new GLWindow("Test", mode.bpp, 0, 0, 0);
gl.create();
Window.create("Test", mode.bpp, 0, 0, 0);
glInit();
@ -220,11 +215,10 @@ public class FullScreenWindowedTest {
if (Keyboard.isKeyDown(Keyboard.KEY_W)) {
try {
Keyboard.destroy();
gl.destroy();
Window.destroy();
Display.resetDisplayMode();
gl = new GLWindow("Test", 50, 50, mode.width, mode.height, mode.bpp, 0, 0, 0);
gl.create();
Window.create("Test", 50, 50, mode.width, mode.height, mode.bpp, 0, 0, 0);
glInit();
@ -282,7 +276,7 @@ public class FullScreenWindowedTest {
*/
private void cleanup() {
Keyboard.destroy();
gl.destroy();
Window.destroy();
}
/**

View file

@ -72,10 +72,9 @@ public final class Game {
}
}
public static final GLWindow gl = new GLWindow("LWJGL Game Example", 16, 0, 0,0);
static {
try {
gl.create();
Window.create("LWJGL Game Example", 16, 0, 0,0);
System.out.println("Created OpenGL.");
} catch (Exception e) {
System.err.println("Failed to create OpenGL due to "+e);
@ -184,7 +183,7 @@ public final class Game {
GL.glGetInteger(GL.GL_MAX_TEXTURE_UNITS_ARB, num_tex_units_buf.asIntBuffer());
System.out.println("Number of texture units: " + num_tex_units_buf.getInt());
// Fix the refresh rate to the display frequency.
// gl.wglSwapIntervalEXT(1);
// GL.wglSwapIntervalEXT(1);
}
/**
@ -193,7 +192,7 @@ public final class Game {
private static void cleanup() {
Keyboard.destroy();
Mouse.destroy();
gl.destroy();
Window.destroy();
try {
Display.resetDisplayMode();
} catch (Exception e) {

View file

@ -88,11 +88,9 @@ public class Grass {
}
}
public static final GLWindow gl = new GLWindow("LWJGL Grass", 50, 50, 640, 480, 16, 0, 0,0);
static {
try {
gl.create();
Window.create("LWJGL Grass", 50, 50, 640, 480, 16, 0, 0,0);
Keyboard.create();
Keyboard.enableBuffer();
Mouse.create();
@ -149,7 +147,7 @@ public class Grass {
GL.GL_VERTEX_PROGRAM_NV,
program_handle,
program_buf);
/*gl.getIntegerv(GL.PROGRAM_ERROR_POSITION_NV, Sys.getDirectBufferAddress(int_buf));
/*GL.glGetInteger(GL.PROGRAM_ERROR_POSITION_NV, int_buf);
System.out.println("error position: " + int_buf.get(0));*/
genMesh();
@ -205,7 +203,7 @@ public class Grass {
}
Mouse.destroy();
Keyboard.destroy();
gl.destroy();
Window.destroy();
}
private static float myrand() {
@ -433,27 +431,6 @@ public class Grass {
}
/* private static void ptrDraw()
{
glRotatef((aslod.angle * 180.0f) / 3.1415f, 0, 1, 0);
glTranslatef(0, 4.5, -7.5);
glRotatef(-90, 0, 1, 0);
glRotatef(-45, 0, 0, 1);
glMaterialfv(GL.FRONT, GL.AMBIENT, vec4f(.1f,.1f,0,1).v);
glMaterialfv(GL.FRONT, GL.DIFFUSE, vec4f(.6f,.6f,.1f,1).v);
glMaterialfv(GL.FRONT, GL.SPECULAR, vec4f(1,1,.75f,1).v);
glMaterialf(GL.FRONT, GL.SHININESS, 128.f);
glutSolidTeapot(aslod.value*5);
gl.rotatef(45, 0, 0, 1);
gl.totatef(90, 0, 1, 0);
gl.translatef(0, -4.5, 7.5);
gl.rotatef(-(aslod.angle * 180.0f) / 3.1415f, 0f, 1f, 0f);
}
*/
private static void ptrAnimate(float degree) {
aslod.count += degree;
aslod.ripple = (float) (java.lang.Math.cos(aslod.count) / 80.0);

View file

@ -51,9 +51,6 @@ public class PbufferTest {
/** Intended deiplay mode */
private DisplayMode mode;
/** GL instance */
private GLWindow gl;
/** GLU instance */
private GLU glu;
@ -98,9 +95,8 @@ public class PbufferTest {
mode = findDisplayMode(800, 600, 16);
// start of in windowed mode
gl = new GLWindow("Test", 50, 50, mode.width, mode.height, mode.bpp, 0, 0, 0);
Window.create("Test", 50, 50, mode.width, mode.height, mode.bpp, 0, 0, 0);
// gl = new GLWindow("Test", 50, 50, mode.width, mode.height, mode.bpp, 0, 0, 0);
gl.create();
if ((Pbuffer.getPbufferCaps() & Pbuffer.PBUFFER_SUPPORTED) == 0) {
System.out.println("No Pbuffer support!");
System.exit(1);
@ -259,11 +255,10 @@ public class PbufferTest {
Keyboard.destroy();
Pbuffer.releaseContext();
pbuffer.destroy();
gl.destroy();
Window.destroy();
Display.setDisplayMode(mode);
gl = new GLWindow("Test", mode.bpp, 0, 0, 0);
gl.create();
Window.create("Test", mode.bpp, 0, 0, 0);
glInit();
initPbuffer();
@ -280,11 +275,10 @@ public class PbufferTest {
Keyboard.destroy();
Pbuffer.releaseContext();
pbuffer.destroy();
gl.destroy();
Window.destroy();
Display.resetDisplayMode();
gl = new GLWindow("Test", 50, 50, mode.width, mode.height, mode.bpp, 0, 0, 0);
gl.create();
Window.create("Test", 50, 50, mode.width, mode.height, mode.bpp, 0, 0, 0);
glInit();
initPbuffer();
@ -352,7 +346,7 @@ public class PbufferTest {
Keyboard.destroy();
Pbuffer.releaseContext();
pbuffer.destroy();
gl.destroy();
Window.destroy();
}
/**

View file

@ -72,10 +72,9 @@ public final class VBOTest {
}
}
public static final GLWindow gl = new GLWindow("LWJGL Game Example", 16, 0, 0,0);
static {
try {
gl.create();
Window.create("LWJGL Game Example", 16, 0, 0,0);
System.out.println("Created OpenGL.");
} catch (Exception e) {
System.err.println("Failed to create OpenGL due to "+e);
@ -210,7 +209,7 @@ public final class VBOTest {
GL.glDeleteBuffersARB(int_buffer);
Keyboard.destroy();
Mouse.destroy();
gl.destroy();
Window.destroy();
try {
Display.resetDisplayMode();
} catch (Exception e) {