From 8d4f24b415303af4d33dcc816c92f92931d0b803 Mon Sep 17 00:00:00 2001 From: Carsten Weisse Date: Thu, 11 Jan 2007 23:36:21 +0000 Subject: add setSwapInterval() for vsync (works on Win32 and Mac OS X) turn it off on console: gl_swapinterval 0 turn it on: gl_swapinterval 1 --- src/jake2/render/basic/Misc.java | 13 ++++++------- src/jake2/render/fast/Misc.java | 12 ++++++++---- src/jake2/render/opengl/CountGL.java | 7 +++++++ src/jake2/render/opengl/DummyGL.java | 7 +++++++ src/jake2/render/opengl/JoglGL.java | 6 ++++++ src/jake2/render/opengl/Jsr231GL.java | 8 +++++++- src/jake2/render/opengl/LwjglGL.java | 7 +++++++ src/jake2/render/opengl/QGL.java | 5 +++++ 8 files changed, 53 insertions(+), 12 deletions(-) (limited to 'src/jake2/render') diff --git a/src/jake2/render/basic/Misc.java b/src/jake2/render/basic/Misc.java index e4ea57c..bc56f0e 100644 --- a/src/jake2/render/basic/Misc.java +++ b/src/jake2/render/basic/Misc.java @@ -2,7 +2,7 @@ * Misc.java * Copyright (C) 2003 * - * $Id: Misc.java,v 1.3 2006-11-22 15:05:38 cawe Exp $ + * $Id: Misc.java,v 1.4 2007-01-11 23:36:15 cawe Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -28,12 +28,13 @@ package jake2.render.basic; import jake2.Defines; import jake2.client.VID; import jake2.qcommon.FS; -import jake2.qcommon.xcommand_t; import jake2.util.Lib; -import java.io.*; -import java.nio.*; +import java.io.File; +import java.io.IOException; +import java.io.RandomAccessFile; import java.nio.ByteBuffer; +import java.nio.FloatBuffer; import java.nio.MappedByteBuffer; import java.nio.channels.FileChannel; @@ -271,9 +272,7 @@ public final class Misc extends Mesh { gl_swapinterval.modified = false; if ( !gl_state.stereo_enabled ) { - if (qwglSwapIntervalEXT) { -// TODO ((WGL)gl).wglSwapIntervalEXT((int)gl_swapinterval.value); - } + gl.setSwapInterval((int) gl_swapinterval.value); } } } diff --git a/src/jake2/render/fast/Misc.java b/src/jake2/render/fast/Misc.java index e1b47e6..d611f34 100644 --- a/src/jake2/render/fast/Misc.java +++ b/src/jake2/render/fast/Misc.java @@ -2,7 +2,7 @@ * Misc.java * Copyright (C) 2003 * - * $Id: Misc.java,v 1.3 2006-11-22 15:05:39 cawe Exp $ + * $Id: Misc.java,v 1.4 2007-01-11 23:36:21 cawe Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -262,6 +262,12 @@ public final class Misc extends Mesh { gl.glEnableClientState(GL_VERTEX_ARRAY); gl.glClientActiveTextureARB(TEXTURE0); gl.glEnableClientState(GL_TEXTURE_COORD_ARRAY); + + /* + * perspective correction + */ + //gl.glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); + } void GL_UpdateSwapInterval() @@ -271,9 +277,7 @@ public final class Misc extends Mesh { gl_swapinterval.modified = false; if ( !gl_state.stereo_enabled ) { - if (qwglSwapIntervalEXT) { - // ((WGL)gl).wgl.glSwapIntervalEXT((int)gl_swapinterval.value); - } + gl.setSwapInterval((int) gl_swapinterval.value); } } } diff --git a/src/jake2/render/opengl/CountGL.java b/src/jake2/render/opengl/CountGL.java index 1e2f525..2752916 100644 --- a/src/jake2/render/opengl/CountGL.java +++ b/src/jake2/render/opengl/CountGL.java @@ -311,4 +311,11 @@ public class CountGL implements QGL { ++count; } + /* + * util extensions + */ + public void setSwapInterval(int interval) { + ++count; + } + } diff --git a/src/jake2/render/opengl/DummyGL.java b/src/jake2/render/opengl/DummyGL.java index c1c592b..eeae547 100644 --- a/src/jake2/render/opengl/DummyGL.java +++ b/src/jake2/render/opengl/DummyGL.java @@ -308,4 +308,11 @@ public class DummyGL implements QGL { // do nothing } + /* + * util extensions + */ + public void setSwapInterval(int interval) { + // do nothing + } + } diff --git a/src/jake2/render/opengl/JoglGL.java b/src/jake2/render/opengl/JoglGL.java index cac4cc9..5296199 100644 --- a/src/jake2/render/opengl/JoglGL.java +++ b/src/jake2/render/opengl/JoglGL.java @@ -307,5 +307,11 @@ public class JoglGL implements QGL { jogl.glMultiTexCoord2f(target, s, t); } + /* + * util extensions + */ + public void setSwapInterval(int interval) { + jogl.setSwapInterval(interval); + } } diff --git a/src/jake2/render/opengl/Jsr231GL.java b/src/jake2/render/opengl/Jsr231GL.java index 02d9e87..0087def 100644 --- a/src/jake2/render/opengl/Jsr231GL.java +++ b/src/jake2/render/opengl/Jsr231GL.java @@ -306,6 +306,12 @@ public class Jsr231GL implements QGL { public void glMultiTexCoord2f(int target, float s, float t) { gl.glMultiTexCoord2f(target, s, t); } - + + /* + * util extensions + */ + public void setSwapInterval(int interval) { + gl.setSwapInterval(interval); + } } diff --git a/src/jake2/render/opengl/LwjglGL.java b/src/jake2/render/opengl/LwjglGL.java index 3557aea..c248c3a 100644 --- a/src/jake2/render/opengl/LwjglGL.java +++ b/src/jake2/render/opengl/LwjglGL.java @@ -301,4 +301,11 @@ public class LwjglGL implements QGL { GL13.glMultiTexCoord2f(target, s, t); } + /* + * util extensions + */ + public void setSwapInterval(int interval) { + Display.setSwapInterval(interval); + } + } diff --git a/src/jake2/render/opengl/QGL.java b/src/jake2/render/opengl/QGL.java index 653da22..81efe59 100644 --- a/src/jake2/render/opengl/QGL.java +++ b/src/jake2/render/opengl/QGL.java @@ -153,5 +153,10 @@ public interface QGL extends QGLConst { void glVertexPointer(int size, int stride, FloatBuffer pointer); void glViewport(int x, int y, int width, int height); + + /* + * util extensions + */ + void setSwapInterval(int interval); } \ No newline at end of file -- cgit v1.2.3