From: Carsten W. <ca...@us...> - 2006-11-21 00:49:57
|
Update of /cvsroot/jake2/jake2/src/jake2/render/opengl In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv15569/src/jake2/render/opengl Added Files: JoglDriver.java Jsr231Driver.java Jsr231GL.java JoglGL.java GLDriver.java LwjglDriver.java LwjglGL.java CountGL.java QGL.java QGLConst.java DummyGL.java Log Message: merge render-refactoring branch into the HEAD --- NEW FILE: QGL.java --- package jake2.render.opengl; import java.nio.*; public interface QGL extends QGLConst { /* * a sub set of OpenGL for Jake2 */ void glActiveTextureARB(int texture); void glAlphaFunc(int func, float ref); void glArrayElement(int index); void glBegin(int mode); void glBindTexture(int target, int texture); void glBlendFunc(int sfactor, int dfactor); void glClear(int mask); void glClearColor(float red, float green, float blue, float alpha); void glClientActiveTextureARB(int texture); void glColor3f(float red, float green, float blue); void glColor3ub(byte red, byte green, byte blue); void glColor4f(float red, float green, float blue, float alpha); void glColor4ub(byte red, byte green, byte blue, byte alpha); void glColorPointer(int size, boolean unsigned, int stride, ByteBuffer pointer); void glColorPointer(int size, int stride, FloatBuffer pointer); void glColorTable(int target, int internalFormat, int width, int format, int type, ByteBuffer data); void glCullFace(int mode); void glDeleteTextures(IntBuffer textures); void glDepthFunc(int func); void glDepthMask(boolean flag); void glDepthRange(double zNear, double zFar); void glDisable(int cap); void glDisableClientState(int cap); void glDrawArrays(int mode, int first, int count); void glDrawBuffer(int mode); void glDrawElements(int mode, IntBuffer indices); void glEnable(int cap); void glEnableClientState(int cap); void glEnd(); void glFinish(); void glFlush(); void glFrustum(double left, double right, double bottom, double top, double zNear, double zFar); int glGetError(); void glGetFloat(int pname, FloatBuffer params); String glGetString(int name); void glInterleavedArrays(int format, int stride, FloatBuffer pointer); void glLockArraysEXT(int first, int count); void glLoadIdentity(); void glLoadMatrix(FloatBuffer m); void glMatrixMode(int mode); void glMultiTexCoord2f(int target, float s, float t); void glOrtho(double left, double right, double bottom, double top, double zNear, double zFar); void glPixelStorei(int pname, int param); void glPointParameterEXT(int pname, FloatBuffer pfParams); void glPointParameterfEXT(int pname, float param); void glPointSize(float size); void glPolygonMode(int face, int mode); void glPopMatrix(); void glPushMatrix(); void glReadPixels(int x, int y, int width, int height, int format, int type, ByteBuffer pixels); void glRotatef(float angle, float x, float y, float z); void glScalef(float x, float y, float z); void glScissor(int x, int y, int width, int height); void glShadeModel(int mode); void glTexCoord2f(float s, float t); void glTexCoordPointer(int size, int stride, FloatBuffer pointer); void glTexEnvi(int target, int pname, int param); void glTexImage2D(int target, int level, int internalformat, int width, int height, int border, int format, int type, ByteBuffer pixels); void glTexImage2D(int target, int level, int internalformat, int width, int height, int border, int format, int type, IntBuffer pixels); void glTexParameterf(int target, int pname, float param); void glTexParameteri(int target, int pname, int param); void glTexSubImage2D(int target, int level, int xoffset, int yoffset, int width, int height, int format, int type, IntBuffer pixels); void glTranslatef(float x, float y, float z); void glUnlockArraysEXT(); void glVertex2f(float x, float y); void glVertex3f(float x, float y, float z); void glVertexPointer(int size, int stride, FloatBuffer pointer); void glViewport(int x, int y, int width, int height); } --- NEW FILE: LwjglDriver.java --- /* * LWJGLBase.java * Copyright (C) 2004 * * $Id: LwjglDriver.java,v 1.2 2006/11/21 00:49:54 cawe Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package jake2.render.opengl; import jake2.Defines; import jake2.client.VID; import jake2.qcommon.Com; import jake2.qcommon.xcommand_t; import jake2.render.Base; import java.awt.Dimension; import java.util.LinkedList; import org.lwjgl.LWJGLException; import org.lwjgl.opengl.Display; import org.lwjgl.opengl.DisplayMode; /** * LWJGLBase * * @author dsanders/cwei */ public class LwjglDriver extends LwjglGL implements GLDriver { protected LwjglDriver() { // see LwjglRenderer } private DisplayMode oldDisplayMode; // window position on the screen int window_xpos, window_ypos; private java.awt.DisplayMode toAwtDisplayMode(DisplayMode m) { return new java.awt.DisplayMode(m.getWidth(), m.getHeight(), m .getBitsPerPixel(), m.getFrequency()); } public java.awt.DisplayMode[] getModeList() { DisplayMode[] modes; try { modes = Display.getAvailableDisplayModes(); } catch (LWJGLException e) { Com.Println(e.getMessage()); return new java.awt.DisplayMode[0]; } LinkedList l = new LinkedList(); l.add(toAwtDisplayMode(oldDisplayMode)); for (int i = 0; i < modes.length; i++) { DisplayMode m = modes[i]; if (m.getBitsPerPixel() != oldDisplayMode.getBitsPerPixel()) continue; if (m.getFrequency() > oldDisplayMode.getFrequency()) continue; if (m.getHeight() < 240 || m.getWidth() < 320) continue; int j = 0; java.awt.DisplayMode ml = null; for (j = 0; j < l.size(); j++) { ml = (java.awt.DisplayMode) l.get(j); if (ml.getWidth() > m.getWidth()) break; if (ml.getWidth() == m.getWidth() && ml.getHeight() >= m.getHeight()) break; } if (j == l.size()) { l.addLast(toAwtDisplayMode(m)); } else if (ml.getWidth() > m.getWidth() || ml.getHeight() > m.getHeight()) { l.add(j, toAwtDisplayMode(m)); } else if (m.getFrequency() > ml.getRefreshRate()) { l.remove(j); l.add(j, toAwtDisplayMode(m)); } } java.awt.DisplayMode[] ma = new java.awt.DisplayMode[l.size()]; l.toArray(ma); return ma; } public DisplayMode[] getLWJGLModeList() { DisplayMode[] modes; try { modes = Display.getAvailableDisplayModes(); } catch (LWJGLException e) { Com.Println(e.getMessage()); return new DisplayMode[0]; } LinkedList l = new LinkedList(); l.add(oldDisplayMode); for (int i = 0; i < modes.length; i++) { DisplayMode m = modes[i]; if (m.getBitsPerPixel() != oldDisplayMode.getBitsPerPixel()) continue; if (m.getFrequency() > oldDisplayMode.getFrequency()) continue; if (m.getHeight() < 240 || m.getWidth() < 320) continue; int j = 0; DisplayMode ml = null; for (j = 0; j < l.size(); j++) { ml = (DisplayMode) l.get(j); if (ml.getWidth() > m.getWidth()) break; if (ml.getWidth() == m.getWidth() && ml.getHeight() >= m.getHeight()) break; } if (j == l.size()) { l.addLast(m); } else if (ml.getWidth() > m.getWidth() || ml.getHeight() > m.getHeight()) { l.add(j, m); } else if (m.getFrequency() > ml.getFrequency()) { l.remove(j); l.add(j, m); } } DisplayMode[] ma = new DisplayMode[l.size()]; l.toArray(ma); return ma; } private DisplayMode findDisplayMode(Dimension dim) { DisplayMode mode = null; DisplayMode m = null; DisplayMode[] modes = getLWJGLModeList(); int w = dim.width; int h = dim.height; for (int i = 0; i < modes.length; i++) { m = modes[i]; if (m.getWidth() == w && m.getHeight() == h) { mode = m; break; } } if (mode == null) mode = oldDisplayMode; return mode; } String getModeString(DisplayMode m) { StringBuffer sb = new StringBuffer(); sb.append(m.getWidth()); sb.append('x'); sb.append(m.getHeight()); sb.append('x'); sb.append(m.getBitsPerPixel()); sb.append('@'); sb.append(m.getFrequency()); sb.append("Hz"); return sb.toString(); } /** * @param dim * @param mode * @param fullscreen * @return enum rserr_t */ public int setMode(Dimension dim, int mode, boolean fullscreen) { Dimension newDim = new Dimension(); VID.Printf(Defines.PRINT_ALL, "Initializing OpenGL display\n"); VID.Printf(Defines.PRINT_ALL, "...setting mode " + mode + ":"); /* * fullscreen handling */ if (oldDisplayMode == null) { oldDisplayMode = Display.getDisplayMode(); } if (!VID.GetModeInfo(newDim, mode)) { VID.Printf(Defines.PRINT_ALL, " invalid mode\n"); return Base.rserr_invalid_mode; } VID.Printf(Defines.PRINT_ALL, " " + newDim.width + " " + newDim.height + '\n'); // destroy the existing window shutdown(); Display.setTitle("Jake2 (lwjgl)"); Display.setLocation(0, 0); DisplayMode displayMode = findDisplayMode(newDim); newDim.width = displayMode.getWidth(); newDim.height = displayMode.getHeight(); if (fullscreen) { try { Display.setDisplayMode(displayMode); } catch (LWJGLException e) { return Base.rserr_invalid_mode; } Display.setLocation(0, 0); try { Display.setFullscreen(fullscreen); } catch (LWJGLException e) { return Base.rserr_invalid_fullscreen; } VID.Printf(Defines.PRINT_ALL, "...setting fullscreen " + getModeString(displayMode) + '\n'); } else { try { Display.setDisplayMode(displayMode); } catch (LWJGLException e) { return Base.rserr_invalid_mode; } try { Display.setFullscreen(false); } catch (LWJGLException e) { return Base.rserr_invalid_fullscreen; } Display.setLocation(window_xpos, window_ypos); } Base.setVid(newDim.width, newDim.height); // vid.width = newDim.width; // vid.height = newDim.height; try { Display.create(); } catch (LWJGLException e) { return Base.rserr_unknown; } // let the sound and input subsystems know about the new window VID.NewWindow(newDim.width, newDim.height); return Base.rserr_ok; } public void shutdown() { if (oldDisplayMode != null && Display.isFullscreen()) { try { Display.setDisplayMode(oldDisplayMode); } catch (Exception e) { e.printStackTrace(); } } while (Display.isCreated()) { Display.destroy(); } } /** * @return true */ public boolean init(int xpos, int ypos) { // do nothing window_xpos = xpos; window_ypos = ypos; return true; } public void beginFrame(float camera_separation) { // do nothing } public void endFrame() { glFlush(); // swap buffers Display.update(); } public void appActivate(boolean activate) { // do nothing } public void enableLogging(boolean enable) { // do nothing } public void logNewFrame() { // do nothing } /** * this is a hack for jogl renderers. * * @param callback */ public final void updateScreen(xcommand_t callback) { callback.execute(); } } --- NEW FILE: LwjglGL.java --- package jake2.render.opengl; import java.nio.*; import org.lwjgl.util.GL; public class LwjglGL implements QGL { LwjglGL() { // singleton } public final void glAlphaFunc(int func, float ref) { GL.glAlphaFunc(func, ref); } public final void glBegin(int mode) { GL.glBegin(mode); } public final void glBindTexture(int target, int texture) { GL.glBindTexture(target, texture); } public final void glBlendFunc(int sfactor, int dfactor) { GL.glBlendFunc(sfactor, dfactor); } public final void glClear(int mask) { GL.glClear(mask); } public final void glClearColor(float red, float green, float blue, float alpha) { GL.glClearColor(red, green, blue, alpha); } public final void glColor3f(float red, float green, float blue) { GL.glColor3f(red, green, blue); } public final void glColor3ub(byte red, byte green, byte blue) { GL.glColor3ub(red, green, blue); } public final void glColor4f(float red, float green, float blue, float alpha) { GL.glColor4f(red, green, blue, alpha); } public final void glColor4ub(byte red, byte green, byte blue, byte alpha) { GL.glColor4ub(red, green, blue, alpha); } public final void glColorPointer(int size, boolean unsigned, int stride, ByteBuffer pointer) { GL.glColorPointer(size, unsigned, stride, pointer); } public final void glColorPointer(int size, int stride, FloatBuffer pointer) { GL.glColorPointer(size, stride, pointer); } public final void glCullFace(int mode) { GL.glCullFace(mode); } public final void glDeleteTextures(IntBuffer textures) { GL.glDeleteTextures(textures); } public final void glDepthFunc(int func) { GL.glDepthFunc(func); } public final void glDepthMask(boolean flag) { GL.glDepthMask(flag); } public final void glDepthRange(double zNear, double zFar) { GL.glDepthRange(zNear, zFar); } public final void glDisable(int cap) { GL.glDisable(cap); } public final void glDisableClientState(int cap) { GL.glDisableClientState(cap); } public final void glDrawArrays(int mode, int first, int count) { GL.glDrawArrays(mode, first, count); } public final void glDrawBuffer(int mode) { GL.glDrawBuffer(mode); } public final void glDrawElements(int mode, IntBuffer indices) { GL.glDrawElements(mode, indices); } public final void glEnable(int cap) { GL.glEnable(cap); } public final void glEnableClientState(int cap) { GL.glEnableClientState(cap); } public final void glEnd() { GL.glEnd(); } public final void glFinish() { GL.glFinish(); } public final void glFlush() { GL.glFlush(); } public final void glFrustum(double left, double right, double bottom, double top, double zNear, double zFar) { GL.glFrustum(left, right, bottom, top, zNear, zFar); } public final int glGetError() { return GL.glGetError(); } public final void glGetFloat(int pname, FloatBuffer params) { GL.glGetFloat(pname, params); } public final String glGetString(int name) { return GL.glGetString(name); } public final void glInterleavedArrays(int format, int stride, FloatBuffer pointer) { GL.glInterleavedArrays(format, stride, pointer); } public final void glLoadIdentity() { GL.glLoadIdentity(); } public final void glLoadMatrix(FloatBuffer m) { GL.glLoadMatrix(m); } public final void glMatrixMode(int mode) { GL.glMatrixMode(mode); } public final void glOrtho(double left, double right, double bottom, double top, double zNear, double zFar) { GL.glOrtho(left, right, bottom, top, zNear, zFar); } public final void glPixelStorei(int pname, int param) { GL.glPixelStorei(pname, param); } public final void glPointSize(float size) { GL.glPointSize(size); } public final void glPolygonMode(int face, int mode) { GL.glPolygonMode(face, mode); } public final void glPopMatrix() { GL.glPopMatrix(); } public final void glPushMatrix() { GL.glPushMatrix(); } public final void glReadPixels(int x, int y, int width, int height, int format, int type, ByteBuffer pixels) { GL.glReadPixels(x, y, width, height, format, type, pixels); } public final void glRotatef(float angle, float x, float y, float z) { GL.glRotatef(angle, x, y, z); } public final void glScalef(float x, float y, float z) { GL.glScalef(x, y, z); } public final void glScissor(int x, int y, int width, int height) { GL.glScissor(x, y, width, height); } public final void glShadeModel(int mode) { GL.glShadeModel(mode); } public final void glTexCoord2f(float s, float t) { GL.glTexCoord2f(s, t); } public final void glTexCoordPointer(int size, int stride, FloatBuffer pointer) { GL.glTexCoordPointer(size, stride, pointer); } public final void glTexEnvi(int target, int pname, int param) { GL.glTexEnvi(target, pname, param); } public final void glTexImage2D(int target, int level, int internalformat, int width, int height, int border, int format, int type, ByteBuffer pixels) { GL.glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels); } public final void glTexImage2D(int target, int level, int internalformat, int width, int height, int border, int format, int type, IntBuffer pixels) { GL.glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels); } public final void glTexParameterf(int target, int pname, float param) { GL.glTexParameterf(target, pname, param); } public final void glTexParameteri(int target, int pname, int param) { GL.glTexParameteri(target, pname, param); } public final void glTexSubImage2D(int target, int level, int xoffset, int yoffset, int width, int height, int format, int type, IntBuffer pixels) { GL.glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels); } public final void glTranslatef(float x, float y, float z) { GL.glTranslatef(x, y, z); } public final void glVertex2f(float x, float y) { GL.glVertex2f(x, y); } public final void glVertex3f(float x, float y, float z) { GL.glVertex3f(x, y, z); } public final void glVertexPointer(int size, int stride, FloatBuffer pointer) { GL.glVertexPointer(size, stride, pointer); } public final void glViewport(int x, int y, int width, int height) { GL.glViewport(x, y, width, height); } public final void glColorTable(int target, int internalFormat, int width, int format, int type, ByteBuffer data) { GL.glColorTable(target, internalFormat, width, format, type, data); } public final void glActiveTextureARB(int texture) { GL.glActiveTextureARB(texture); } public final void glClientActiveTextureARB(int texture) { GL.glClientActiveTextureARB(texture); } public final void glPointParameterEXT(int pname, FloatBuffer pfParams) { GL.glPointParameterEXT(pname, pfParams); } public final void glPointParameterfEXT(int pname, float param) { GL.glPointParameterfEXT(pname, param); } public final void glLockArraysEXT(int first, int count) { GL.glLockArraysEXT(first, count); } public final void glArrayElement(int index) { GL.glArrayElement(index); } public final void glUnlockArraysEXT() { GL.glUnlockArraysEXT(); } public final void glMultiTexCoord2f(int target, float s, float t) { GL.glMultiTexCoord2f(target, s, t); } } --- NEW FILE: DummyGL.java --- package jake2.render.opengl; import java.nio.*; public class DummyGL implements QGL { private static QGL self = new DummyGL(); private DummyGL() { // singleton } public static QGL getInstance() { return self; } public void glAlphaFunc(int func, float ref) { // do nothing } public void glBegin(int mode) { // do nothing } public void glBindTexture(int target, int texture) { // do nothing } public void glBlendFunc(int sfactor, int dfactor) { // do nothing } public void glClear(int mask) { // do nothing } public void glClearColor(float red, float green, float blue, float alpha) { // do nothing } public void glColor3f(float red, float green, float blue) { // do nothing } public void glColor3ub(byte red, byte green, byte blue) { // do nothing } public void glColor4f(float red, float green, float blue, float alpha) { // do nothing } public void glColor4ub(byte red, byte green, byte blue, byte alpha) { // do nothing } public void glColorPointer(int size, boolean unsigned, int stride, ByteBuffer pointer) { // do nothing } public void glColorPointer(int size, int stride, FloatBuffer pointer) { // do nothing } public void glCullFace(int mode) { // do nothing } public void glDeleteTextures(IntBuffer textures) { // do nothing } public void glDepthFunc(int func) { // do nothing } public void glDepthMask(boolean flag) { // do nothing } public void glDepthRange(double zNear, double zFar) { // do nothing } public void glDisable(int cap) { // do nothing } public void glDisableClientState(int cap) { // do nothing } public void glDrawArrays(int mode, int first, int count) { // do nothing } public void glDrawBuffer(int mode) { // do nothing } public void glDrawElements(int mode, IntBuffer indices) { // do nothing } public void glEnable(int cap) { // do nothing } public void glEnableClientState(int cap) { // do nothing } public void glEnd() { // do nothing } public void glFinish() { // do nothing } public void glFlush() { // do nothing } public void glFrustum(double left, double right, double bottom, double top, double zNear, double zFar) { // do nothing } public int glGetError() { return GL_NO_ERROR; } public void glGetFloat(int pname, FloatBuffer params) { // do nothing } public String glGetString(int name) { switch (name) { case GL_EXTENSIONS: return "GL_ARB_multitexture"; default: return ""; } } public void glInterleavedArrays(int format, int stride, FloatBuffer pointer) { // do nothing } public void glLoadIdentity() { // do nothing } public void glLoadMatrix(FloatBuffer m) { // do nothing } public void glMatrixMode(int mode) { // do nothing } public void glOrtho(double left, double right, double bottom, double top, double zNear, double zFar) { // do nothing } public void glPixelStorei(int pname, int param) { // do nothing } public void glPointSize(float size) { // do nothing } public void glPolygonMode(int face, int mode) { // do nothing } public void glPopMatrix() { // do nothing } public void glPushMatrix() { // do nothing } public void glReadPixels(int x, int y, int width, int height, int format, int type, ByteBuffer pixels) { // do nothing } public void glRotatef(float angle, float x, float y, float z) { // do nothing } public void glScalef(float x, float y, float z) { // do nothing } public void glScissor(int x, int y, int width, int height) { // do nothing } public void glShadeModel(int mode) { // do nothing } public void glTexCoord2f(float s, float t) { // do nothing } public void glTexCoordPointer(int size, int stride, FloatBuffer pointer) { // do nothing } public void glTexEnvi(int target, int pname, int param) { // do nothing } public void glTexImage2D(int target, int level, int internalformat, int width, int height, int border, int format, int type, ByteBuffer pixels) { // do nothing } public void glTexImage2D(int target, int level, int internalformat, int width, int height, int border, int format, int type, IntBuffer pixels) { // do nothing } public void glTexParameterf(int target, int pname, float param) { // do nothing } public void glTexParameteri(int target, int pname, int param) { // do nothing } public void glTexSubImage2D(int target, int level, int xoffset, int yoffset, int width, int height, int format, int type, IntBuffer pixels) { // do nothing } public void glTranslatef(float x, float y, float z) { // do nothing } public void glVertex2f(float x, float y) { // do nothing } public void glVertex3f(float x, float y, float z) { // do nothing } public void glVertexPointer(int size, int stride, FloatBuffer pointer) { // do nothing } public void glViewport(int x, int y, int width, int height) { // do nothing } public void glColorTable(int target, int internalFormat, int width, int format, int type, ByteBuffer data) { // do nothing } public void glActiveTextureARB(int texture) { // do nothing } public void glClientActiveTextureARB(int texture) { // do nothing } public void glPointParameterEXT(int pname, FloatBuffer pfParams) { // do nothing } public void glPointParameterfEXT(int pname, float param) { // do nothing } public void glLockArraysEXT(int first, int count) { // do nothing } public void glArrayElement(int index) { // do nothing } public void glUnlockArraysEXT() { // do nothing } public void glMultiTexCoord2f(int target, float s, float t) { // do nothing } } --- NEW FILE: JoglGL.java --- package jake2.render.opengl; import java.nio.*; import net.java.games.jogl.GL; public class JoglGL implements QGL { private GL jogl; JoglGL() { // singleton } void setGL(GL context) { this.jogl = context; } public void glAlphaFunc(int func, float ref) { jogl.glAlphaFunc(func, ref); } public void glBegin(int mode) { jogl.glBegin(mode); } public void glBindTexture(int target, int texture) { jogl.glBindTexture(target, texture); } public void glBlendFunc(int sfactor, int dfactor) { jogl.glBlendFunc(sfactor, dfactor); } public void glClear(int mask) { jogl.glClear(mask); } public void glClearColor(float red, float green, float blue, float alpha) { jogl.glClearColor(red, green, blue, alpha); } public void glColor3f(float red, float green, float blue) { jogl.glColor3f(red, green, blue); } public void glColor3ub(byte red, byte green, byte blue) { jogl.glColor3ub(red, green, blue); } public void glColor4f(float red, float green, float blue, float alpha) { jogl.glColor4f(red, green, blue, alpha); } public void glColor4ub(byte red, byte green, byte blue, byte alpha) { jogl.glColor4ub(red, green, blue, alpha); } public void glColorPointer(int size, boolean unsigned, int stride, ByteBuffer pointer) { jogl.glColorPointer(size, GL_UNSIGNED_BYTE, stride, pointer); } public void glColorPointer(int size, int stride, FloatBuffer pointer) { jogl.glColorPointer(size, GL_FLOAT, stride, pointer); } public void glCullFace(int mode) { jogl.glCullFace(mode); } public void glDeleteTextures(IntBuffer textures) { jogl.glDeleteTextures(textures.limit(), textures); } public void glDepthFunc(int func) { jogl.glDepthFunc(func); } public void glDepthMask(boolean flag) { jogl.glDepthMask(flag); } public void glDepthRange(double zNear, double zFar) { jogl.glDepthRange(zNear, zFar); } public void glDisable(int cap) { jogl.glDisable(cap); } public void glDisableClientState(int cap) { jogl.glDisableClientState(cap); } public void glDrawArrays(int mode, int first, int count) { jogl.glDrawArrays(mode, first, count); } public void glDrawBuffer(int mode) { jogl.glDrawBuffer(mode); } public void glDrawElements(int mode, IntBuffer indices) { jogl.glDrawElements(mode, indices.limit(), GL_UNSIGNED_INT, indices); } public void glEnable(int cap) { jogl.glEnable(cap); } public void glEnableClientState(int cap) { jogl.glEnableClientState(cap); } public void glEnd() { jogl.glEnd(); } public void glFinish() { jogl.glFinish(); } public void glFlush() { jogl.glFlush(); } public void glFrustum(double left, double right, double bottom, double top, double zNear, double zFar) { jogl.glFrustum(left, right, bottom, top, zNear, zFar); } public int glGetError() { return jogl.glGetError(); } public void glGetFloat(int pname, FloatBuffer params) { jogl.glGetFloatv(pname, params); } public String glGetString(int name) { return jogl.glGetString(name); } public void glInterleavedArrays(int format, int stride, FloatBuffer pointer) { jogl.glInterleavedArrays(format, stride, pointer); } public void glLoadIdentity() { jogl.glLoadIdentity(); } public void glLoadMatrix(FloatBuffer m) { jogl.glLoadMatrixf(m); } public void glMatrixMode(int mode) { jogl.glMatrixMode(mode); } public void glOrtho(double left, double right, double bottom, double top, double zNear, double zFar) { jogl.glOrtho(left, right, bottom, top, zNear, zFar); } public void glPixelStorei(int pname, int param) { jogl.glPixelStorei(pname, param); } public void glPointSize(float size) { jogl.glPointSize(size); } public void glPolygonMode(int face, int mode) { jogl.glPolygonMode(face, mode); } public void glPopMatrix() { jogl.glPopMatrix(); } public void glPushMatrix() { jogl.glPushMatrix(); } public void glReadPixels(int x, int y, int width, int height, int format, int type, ByteBuffer pixels) { jogl.glReadPixels(x, y, width, height, format, type, pixels); } public void glRotatef(float angle, float x, float y, float z) { jogl.glRotatef(angle, x, y, z); } public void glScalef(float x, float y, float z) { jogl.glScalef(x, y, z); } public void glScissor(int x, int y, int width, int height) { jogl.glScissor(x, y, width, height); } public void glShadeModel(int mode) { jogl.glShadeModel(mode); } public void glTexCoord2f(float s, float t) { jogl.glTexCoord2f(s, t); } public void glTexCoordPointer(int size, int stride, FloatBuffer pointer) { jogl.glTexCoordPointer(size, GL_FLOAT, stride, pointer); } public void glTexEnvi(int target, int pname, int param) { jogl.glTexEnvi(target, pname, param); } public void glTexImage2D(int target, int level, int internalformat, int width, int height, int border, int format, int type, ByteBuffer pixels) { jogl.glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels); } public void glTexImage2D(int target, int level, int internalformat, int width, int height, int border, int format, int type, IntBuffer pixels) { jogl.glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels); } public void glTexParameterf(int target, int pname, float param) { jogl.glTexParameterf(target, pname, param); } public void glTexParameteri(int target, int pname, int param) { jogl.glTexParameteri(target, pname, param); } public void glTexSubImage2D(int target, int level, int xoffset, int yoffset, int width, int height, int format, int type, IntBuffer pixels) { jogl.glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels); } public void glTranslatef(float x, float y, float z) { jogl.glTranslatef(x, y, z); } public void glVertex2f(float x, float y) { jogl.glVertex2f(x, y); } public void glVertex3f(float x, float y, float z) { jogl.glVertex3f(x, y, z); } public void glVertexPointer(int size, int stride, FloatBuffer pointer) { jogl.glVertexPointer(size, GL_FLOAT, stride, pointer); } public void glViewport(int x, int y, int width, int height) { jogl.glViewport(x, y, width, height); } public void glColorTable(int target, int internalFormat, int width, int format, int type, ByteBuffer data) { jogl.glColorTable(target, internalFormat, width, format, type, data); } public void glActiveTextureARB(int texture) { jogl.glActiveTextureARB(texture); } public void glClientActiveTextureARB(int texture) { jogl.glClientActiveTextureARB(texture); } public void glPointParameterEXT(int pname, FloatBuffer pfParams) { jogl.glPointParameterfvEXT(pname, pfParams); } public void glPointParameterfEXT(int pname, float param) { jogl.glPointParameterfEXT(pname, param); } public void glLockArraysEXT(int first, int count) { jogl.glLockArraysEXT(first, count); } public void glArrayElement(int index) { jogl.glArrayElement(index); } public void glUnlockArraysEXT() { jogl.glUnlockArraysEXT(); } public void glMultiTexCoord2f(int target, float s, float t) { jogl.glMultiTexCoord2f(target, s, t); } } --- NEW FILE: Jsr231GL.java --- package jake2.render.opengl; import java.nio.*; import javax.media.opengl.GL; public class Jsr231GL implements QGL { private GL gl; Jsr231GL() { // singleton } void setGL(GL gl) { this.gl = gl; } public void glAlphaFunc(int func, float ref) { gl.glAlphaFunc(func, ref); } public void glBegin(int mode) { gl.glBegin(mode); } public void glBindTexture(int target, int texture) { gl.glBindTexture(target, texture); } public void glBlendFunc(int sfactor, int dfactor) { gl.glBlendFunc(sfactor, dfactor); } public void glClear(int mask) { gl.glClear(mask); } public void glClearColor(float red, float green, float blue, float alpha) { gl.glClearColor(red, green, blue, alpha); } public void glColor3f(float red, float green, float blue) { gl.glColor3f(red, green, blue); } public void glColor3ub(byte red, byte green, byte blue) { gl.glColor3ub(red, green, blue); } public void glColor4f(float red, float green, float blue, float alpha) { gl.glColor4f(red, green, blue, alpha); } public void glColor4ub(byte red, byte green, byte blue, byte alpha) { gl.glColor4ub(red, green, blue, alpha); } public void glColorPointer(int size, boolean unsigned, int stride, ByteBuffer pointer) { gl.glColorPointer(size, GL_UNSIGNED_BYTE, stride, pointer); } public void glColorPointer(int size, int stride, FloatBuffer pointer) { gl.glColorPointer(size, GL_FLOAT, stride, pointer); } public void glCullFace(int mode) { gl.glCullFace(mode); } public void glDeleteTextures(IntBuffer textures) { gl.glDeleteTextures(textures.limit(), textures); } public void glDepthFunc(int func) { gl.glDepthFunc(func); } public void glDepthMask(boolean flag) { gl.glDepthMask(flag); } public void glDepthRange(double zNear, double zFar) { gl.glDepthRange(zNear, zFar); } public void glDisable(int cap) { gl.glDisable(cap); } public void glDisableClientState(int cap) { gl.glDisableClientState(cap); } public void glDrawArrays(int mode, int first, int count) { gl.glDrawArrays(mode, first, count); } public void glDrawBuffer(int mode) { gl.glDrawBuffer(mode); } public void glDrawElements(int mode, IntBuffer indices) { gl.glDrawElements(mode, indices.limit(), GL_UNSIGNED_INT, indices); } public void glEnable(int cap) { gl.glEnable(cap); } public void glEnableClientState(int cap) { gl.glEnableClientState(cap); } public void glEnd() { gl.glEnd(); } public void glFinish() { gl.glFinish(); } public void glFlush() { gl.glFlush(); } public void glFrustum(double left, double right, double bottom, double top, double zNear, double zFar) { gl.glFrustum(left, right, bottom, top, zNear, zFar); } public int glGetError() { return gl.glGetError(); } public void glGetFloat(int pname, FloatBuffer params) { gl.glGetFloatv(pname, params); } public String glGetString(int name) { return gl.glGetString(name); } public void glInterleavedArrays(int format, int stride, FloatBuffer pointer) { gl.glInterleavedArrays(format, stride, pointer); } public void glLoadIdentity() { gl.glLoadIdentity(); } public void glLoadMatrix(FloatBuffer m) { gl.glLoadMatrixf(m); } public void glMatrixMode(int mode) { gl.glMatrixMode(mode); } public void glOrtho(double left, double right, double bottom, double top, double zNear, double zFar) { gl.glOrtho(left, right, bottom, top, zNear, zFar); } public void glPixelStorei(int pname, int param) { gl.glPixelStorei(pname, param); } public void glPointSize(float size) { gl.glPointSize(size); } public void glPolygonMode(int face, int mode) { gl.glPolygonMode(face, mode); } public void glPopMatrix() { gl.glPopMatrix(); } public void glPushMatrix() { gl.glPushMatrix(); } public void glReadPixels(int x, int y, int width, int height, int format, int type, ByteBuffer pixels) { gl.glReadPixels(x, y, width, height, format, type, pixels); } public void glRotatef(float angle, float x, float y, float z) { gl.glRotatef(angle, x, y, z); } public void glScalef(float x, float y, float z) { gl.glScalef(x, y, z); } public void glScissor(int x, int y, int width, int height) { gl.glScissor(x, y, width, height); } public void glShadeModel(int mode) { gl.glShadeModel(mode); } public void glTexCoord2f(float s, float t) { gl.glTexCoord2f(s, t); } public void glTexCoordPointer(int size, int stride, FloatBuffer pointer) { gl.glTexCoordPointer(size, GL_FLOAT, stride, pointer); } public void glTexEnvi(int target, int pname, int param) { gl.glTexEnvi(target, pname, param); } public void glTexImage2D(int target, int level, int internalformat, int width, int height, int border, int format, int type, ByteBuffer pixels) { gl.glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels); } public void glTexImage2D(int target, int level, int internalformat, int width, int height, int border, int format, int type, IntBuffer pixels) { gl.glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels); } public void glTexParameterf(int target, int pname, float param) { gl.glTexParameterf(target, pname, param); } public void glTexParameteri(int target, int pname, int param) { gl.glTexParameteri(target, pname, param); } public void glTexSubImage2D(int target, int level, int xoffset, int yoffset, int width, int height, int format, int type, IntBuffer pixels) { gl.glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels); } public void glTranslatef(float x, float y, float z) { gl.glTranslatef(x, y, z); } public void glVertex2f(float x, float y) { gl.glVertex2f(x, y); } public void glVertex3f(float x, float y, float z) { gl.glVertex3f(x, y, z); } public void glVertexPointer(int size, int stride, FloatBuffer pointer) { gl.glVertexPointer(size, GL_FLOAT, stride, pointer); } public void glViewport(int x, int y, int width, int height) { gl.glViewport(x, y, width, height); } public void glColorTable(int target, int internalFormat, int width, int format, int type, ByteBuffer data) { gl.glColorTable(target, internalFormat, width, format, type, data); } public void glActiveTextureARB(int texture) { gl.glActiveTexture(texture); } public void glClientActiveTextureARB(int texture) { gl.glClientActiveTexture(texture); } public void glPointParameterEXT(int pname, FloatBuffer pfParams) { gl.glPointParameterfvEXT(pname, pfParams); } public void glPointParameterfEXT(int pname, float param) { gl.glPointParameterfEXT(pname, param); } public void glLockArraysEXT(int first, int count) { gl.glLockArraysEXT(first, count); } public void glArrayElement(int index) { gl.glArrayElement(index); } public void glUnlockArraysEXT() { gl.glUnlockArraysEXT(); } public void glMultiTexCoord2f(int target, float s, float t) { gl.glMultiTexCoord2f(target, s, t); } } --- NEW FILE: QGLConst.java --- package jake2.render.opengl; public interface QGLConst { /* * alpha functions */ public static final int GL_NEVER = 0x0200; public static final int GL_LESS = 0x0201; public static final int GL_EQUAL = 0x0202; public static final int GL_LEQUAL = 0x0203; public static final int GL_GREATER = 0x0204; public static final int GL_NOTEQUAL = 0x0205; public static final int GL_GEQUAL = 0x0206; public static final int GL_ALWAYS = 0x0207; /* * attribute masks */ public static final int GL_DEPTH_BUFFER_BIT = 0x00000100; public static final int GL_STENCIL_BUFFER_BIT = 0x00000400; public static final int GL_COLOR_BUFFER_BIT = 0x00004000; /* * begin modes */ public static final int GL_POINTS = 0x0000; public static final int GL_LINES = 0x0001; public static final int GL_LINE_LOOP = 0x0002; public static final int GL_LINE_STRIP = 0x0003; public static final int GL_TRIANGLES = 0x0004; public static final int GL_TRIANGLE_STRIP = 0x0005; public static final int GL_TRIANGLE_FAN = 0x0006; public static final int GL_QUADS = 0x0007; public static final int GL_QUAD_STRIP = 0x0008; public static final int GL_POLYGON = 0x0009; /* * blending factors */ public static final int GL_ZERO = 0; public static final int GL_ONE = 1; public static final int GL_SRC_COLOR = 0x0300; public static final int GL_ONE_MINUS_SRC_COLOR = 0x0301; public static final int GL_SRC_ALPHA = 0x0302; public static final int GL_ONE_MINUS_SRC_ALPHA = 0x0303; public static final int GL_DST_ALPHA = 0x0304; public static final int GL_ONE_MINUS_DST_ALPHA = 0x0305; /* * boolean */ public static final int GL_TRUE = 1; public static final int GL_FALSE = 0; /* * data types */ public static final int GL_BYTE = 0x1400; public static final int GL_UNSIGNED_BYTE = 0x1401; public static final int GL_SHORT = 0x1402; public static final int GL_UNSIGNED_SHORT = 0x1403; public static final int GL_INT = 0x1404; public static final int GL_UNSIGNED_INT = 0x1405; public static final int GL_FLOAT = 0x1406; /* * draw buffer modes */ public static final int GL_FRONT = 0x0404; public static final int GL_BACK = 0x0405; public static final int GL_FRONT_AND_BACK = 0x0408; /* * errors */ public static final int GL_NO_ERROR = 0; public static final int GL_POINT_SMOOTH = 0x0B10; public static final int GL_CULL_FACE = 0x0B44; public static final int GL_DEPTH_TEST = 0x0B71; public static final int GL_MODELVIEW_MATRIX = 0x0BA6; public static final int GL_ALPHA_TEST = 0x0BC0; public static final int GL_BLEND = 0x0BE2; public static final int GL_SCISSOR_TEST = 0x0C11; public static final int GL_PACK_ALIGNMENT = 0x0D05; public static final int GL_TEXTURE_2D = 0x0DE1; /* * hint modes */ public static final int GL_DONT_CARE = 0x1100; public static final int GL_FASTEST = 0x1101; public static final int GL_NICEST = 0x1102; /* * matrix modes */ public static final int GL_MODELVIEW = 0x1700; public static final int GL_PROJECTION = 0x1701; /* * pixel formats */ public static final int GL_COLOR_INDEX = 0x1900; public static final int GL_RED = 0x1903; public static final int GL_GREEN = 0x1904; public static final int GL_BLUE = 0x1905; public static final int GL_ALPHA = 0x1906; public static final int GL_RGB = 0x1907; public static final int GL_RGBA = 0x1908; public static final int GL_LUMINANCE = 0x1909; public static final int GL_LUMINANCE_ALPHA = 0x190A; /* * polygon modes */ public static final int GL_POINT = 0x1B00; public static final int GL_LINE = 0x1B01; public static final int GL_FILL = 0x1B02; /* * shading models */ public static final int GL_FLAT = 0x1D00; public static final int GL_SMOOTH = 0x1D01; public static final int GL_REPLACE = 0x1E01; /* * string names */ public static final int GL_VENDOR = 0x1F00; public static final int GL_RENDERER = 0x1F01; public static final int GL_VERSION = 0x1F02; public static final int GL_EXTENSIONS = 0x1F03; /* * TextureEnvMode */ public static final int GL_MODULATE = 0x2100; /* * TextureEnvParameter */ public static final int GL_TEXTURE_ENV_MODE = 0x2200; public static final int GL_TEXTURE_ENV_COLOR = 0x2201; /* * TextureEnvTarget */ public static final int GL_TEXTURE_ENV = 0x2300; public static final int GL_NEAREST = 0x2600; public static final int GL_LINEAR = 0x2601; public static final int GL_NEAREST_MIPMAP_NEAREST = 0x2700; public static final int GL_LINEAR_MIPMAP_NEAREST = 0x2701; public static final int GL_NEAREST_MIPMAP_LINEAR = 0x2702; public static final int GL_LINEAR_MIPMAP_LINEAR = 0x2703; /* * TextureParameterName */ public static final int GL_TEXTURE_MAG_FILTER = 0x2800; public static final int GL_TEXTURE_MIN_FILTER = 0x2801; public static final int GL_TEXTURE_WRAP_S = 0x2802; public static final int GL_TEXTURE_WRAP_T = 0x2803; /* * TextureWrapMode */ public static final int GL_CLAMP = 0x2900; public static final int GL_REPEAT = 0x2901; /* * texture */ public static final int GL_LUMINANCE8 = 0x8040; public static final int GL_INTENSITY8 = 0x804B; public static final int GL_R3_G3_B2 = 0x2A10; public static final int GL_RGB4 = 0x804F; public static final int GL_RGB5 = 0x8050; public static final int GL_RGB8 = 0x8051; public static final int GL_RGBA2 = 0x8055; public static final int GL_RGBA4 = 0x8056; public static final int GL_RGB5_A1 = 0x8057; public static final int GL_RGBA8 = 0x8058; /* * vertex arrays */ public static final int GL_VERTEX_ARRAY = 0x8074; public static final int GL_COLOR_ARRAY = 0x8076; public static final int GL_TEXTURE_COORD_ARRAY = 0x8078; public static final int GL_T2F_V3F = 0x2A27; /* * OpenGL 1.2, 1.3 constants */ public static final int GL_SHARED_TEXTURE_PALETTE_EXT = 0x81FB; public static final int GL_TEXTURE0 = 0x84C0; public static final int GL_TEXTURE1 = 0x84C1; public static final int GL_TEXTURE0_ARB = 0x84C0; public static final int GL_TEXTURE1_ARB = 0x84C1; public static final int GL_BGR = 0x80E0; public static final int GL_BGRA = 0x80E1; /* * point parameters */ public static final int GL_POINT_SIZE_MIN_EXT = 0x8126; public static final int GL_POINT_SIZE_MAX_EXT = 0x8127; public static final int GL_POINT_FADE_THRESHOLD_SIZE_EXT = 0x8128; public static final int GL_DISTANCE_ATTENUATION_EXT = 0x8129; } --- NEW FILE: CountGL.java --- package jake2.render.opengl; import java.nio.*; public class CountGL implements QGL { private static int count = 0; private static QGL self = new CountGL(); private CountGL() { // singleton } public static QGL getInstance() { return self; } public void glAlphaFunc(int func, float ref) { count++; } public void glBegin(int mode) { count++; } public void glBindTexture(int target, int texture) { count++; } public void glBlendFunc(int sfactor, int dfactor) { count++; } public void glClear(int mask) { count++; } public void glClearColor(float red, float green, float blue, float alpha) { count++; } public void glColor3f(float red, float green, float blue) { count++; } public void glColor3ub(byte red, byte green, byte blue) { count++; } public void glColor4f(float red, float green, float blue, float alpha) { count++; } public void glColor4ub(byte red, byte green, byte blue, byte alpha) { count++; } public void glColorPointer(int size, boolean unsigned, int stride, ByteBuffer pointer) { count++; } public void glColorPointer(int size, int stride, FloatBuffer pointer) { count++; } public void glCullFace(int mode) { count++; } public void glDeleteTextures(IntBuffer textures) { count++; } public void glDepthFunc(int func) { count++; } public void glDepthMask(boolean flag) { count++; } public void glDepthRange(double zNear, double zFar) { count++; } public void glDisable(int cap) { count++; } public void glDisableClientState(int cap) { count++; } public void glDrawArrays(int mode, int first, int count) { count++; } public void glDrawBuffer(int mode) { count++; } public void glDrawElements(int mode, IntBuffer indices) { count++; } public void glEnable(int cap) { count++; } public void glEnableClientState(int cap) { count++; } public void glEnd() { count++; } public void glFinish() { count++; } public void glFlush() { System.err.println("GL calls/frame: " + (++count)); count = 0; } public void glFrustum(double left, double right, double bottom, double top, double zNear, double zFar) { count++; } public int glGetError() { return GL_NO_ERROR; } public void glGetFloat(int pname, FloatBuffer params) { count++; } public String glGetString(int name) { switch (name) { case GL_EXTENSIONS: return "GL_ARB_multitexture"; default: return ""; } } public void glInterleavedArrays(int format, int stride, FloatBuffer pointer) { count++; } public void glLoadIdentity() { count++; } public void glLoadMatrix(FloatBuffer m) { count++; } public void glMatrixMode(int mode) { count++; } public void glOrtho(double left, double right, double bottom, double top, double zNear, double zFar) { count++; } public void glPixelStorei(int pname, int param) { count++; } public void glPointSize(float size) { count++; } public void glPolygonMode(int face, int mode) { count++; } public void glPopMatrix() { count++; } public void glPushMatrix() { count++; } public void glReadPixels(int x, int y, int width, int height, int format, int type, ByteBuffer pixels) { count++; } public void glRotatef(float angle, float x, float y, float z) { count++; } public void glScalef(float x, float y, float z) { count++; } public void glScissor(int x, int y, int width, int height) { count++; } public void glShadeModel(int mode) { count++; } public void glTexCoord2f(float s, float t) { count++; } public void glTexCoordPointer(int size, int stride, FloatBuffer pointer) { count++; } public void glTexEnvi(int target, int pname, int param) { count++; } public void glTexImage2D(int target, int level, int internalformat, int width, int height, int border, int format, int type, ByteBuffer pixels) { count++; } public void glTexImage2D(int target, int level, int internalformat, int width, int height, int border, int format, int type, IntBuffer pixels) { count++; } public void glTexParameterf(int target, int pname, float param) { count++; } public void glTexParameteri(int target, int pname, int param) { count++; } public void glTexSubImage2D(int target, int level, int xoffset, int yoffset, int width, int height, int format, int type, IntBuffer pixels) { count++; } public void glTranslatef(float x, float y, float z) { count++; } public void glVertex2f(float x, float y) { count++; } public void glVertex3f(float x, float y, float z) { count++; } public void glVertexPointer(int size, int stride, FloatBuffer pointer) { count++; } public void glViewport(int x, int y, int width, int height) { count++; } public void glColorTable(int target, int internalFormat, int width, int format, int type, ByteBuffer data) { count++; } public void glActiveTextureARB(int texture) { count++; } public void glClientActiveTextureARB(int texture) { count++; } public void glPointParameterEXT(int pname, FloatBuffer pfParams) { count++; } public void glPointParameterfEXT(int pname, float param) { count++; } public void glLockArraysEXT(int first, int count) { count++; } public void glArrayElement(int index) { count++; } public void glUnlockArraysEXT() { count++; } public void glMultiTexCoord2f(int target, float s, float t) { count++; } } --- NEW FILE: Jsr231Driver.java --- /* * JoglCommon.java * Copyright (C) 2004 * * $Id: Jsr231Driver.java,v 1.2 2006/11/21 00:49:54 cawe Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package jake2.render.opengl; import jake2.Defines; import jake2.client.VID; import jake2.qcommon.Cbuf; import jake2.qcommon.xcommand_t; import jake2.render.Base; import jake2.sys.JOGLKBD; import java.awt.*; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.util.LinkedList; import javax.media.opengl.*; import javax.swing.ImageIcon; import javax.swing.JFrame; /** * JoglCommon */ public class Jsr231Driver extends Jsr231GL implements GLDriver { protected Jsr231Driver() { // singleton } private GraphicsDevice device; private DisplayMode oldDisplayMode; private Display display; JFrame window; // window position on the screen int window_xpos, window_ypos; public DisplayMode[] getModeList() { DisplayMode[] modes = device.getDisplayModes(); LinkedList l = new LinkedList(); l.add(oldDisplayMode); for (int i = 0; i < modes.length; i++) { DisplayMode m = modes[i]; if (m.getBitDepth() != oldDisplayMode.getBitDepth()) continue; if (m.getRefreshRate() > oldDisplayMode.getRefreshRate()) continue; if (m.getHeight() < 240 || m.getWidth() < 320) continue; int j = 0; DisplayMode ml = null; for (j = 0; j < l.size(); j++) { ml = (DisplayMode)l.get(j); if (ml.getWidth() > m.getWidth()) break; if (ml.getWidth() == m.getWidth() && ml.getHeight() >= m.getHeight()) break; } if (j == l.size()) { l.a... [truncated message content] |