aboutsummaryrefslogtreecommitdiffstats
path: root/src/jake2/render/opengl
diff options
context:
space:
mode:
Diffstat (limited to 'src/jake2/render/opengl')
-rw-r--r--src/jake2/render/opengl/GLDriver.java4
-rw-r--r--src/jake2/render/opengl/JoglDummyDriver.java4
-rw-r--r--src/jake2/render/opengl/JoglES1Driver.java4
-rw-r--r--src/jake2/render/opengl/JoglES2Driver.java4
-rw-r--r--src/jake2/render/opengl/JoglGL2Driver.java4
-rw-r--r--src/jake2/render/opengl/NEWTWin.java46
6 files changed, 34 insertions, 32 deletions
diff --git a/src/jake2/render/opengl/GLDriver.java b/src/jake2/render/opengl/GLDriver.java
index 0967576..d350811 100644
--- a/src/jake2/render/opengl/GLDriver.java
+++ b/src/jake2/render/opengl/GLDriver.java
@@ -6,7 +6,7 @@ import javax.media.nativewindow.util.Dimension;
import jake2.qcommon.xcommand_t;
-import com.jogamp.newt.ScreenMode;
+import com.jogamp.newt.MonitorMode;
public interface GLDriver {
@@ -26,7 +26,7 @@ public interface GLDriver {
void logNewFrame();
- List<ScreenMode> getModeList();
+ List<MonitorMode> getModeList();
void updateScreen(xcommand_t callback);
diff --git a/src/jake2/render/opengl/JoglDummyDriver.java b/src/jake2/render/opengl/JoglDummyDriver.java
index 3316f2a..73620b2 100644
--- a/src/jake2/render/opengl/JoglDummyDriver.java
+++ b/src/jake2/render/opengl/JoglDummyDriver.java
@@ -33,7 +33,7 @@ import jake2.render.Base;
import javax.media.nativewindow.util.Dimension;
import javax.media.opengl.*;
-import com.jogamp.newt.ScreenMode;
+import com.jogamp.newt.MonitorMode;
/**
* JoglCommon
@@ -51,7 +51,7 @@ public abstract class JoglDummyDriver extends DummyGL implements GLDriver {
public abstract String getName();
- public List<ScreenMode> getModeList() {
+ public List<MonitorMode> getModeList() {
if(null == newtWin) {
throw new RuntimeException("NEWTWin not yet initialized.");
}
diff --git a/src/jake2/render/opengl/JoglES1Driver.java b/src/jake2/render/opengl/JoglES1Driver.java
index d9001ae..f9a29f8 100644
--- a/src/jake2/render/opengl/JoglES1Driver.java
+++ b/src/jake2/render/opengl/JoglES1Driver.java
@@ -35,7 +35,7 @@ import jake2.render.Base;
import javax.media.nativewindow.util.Dimension;
import javax.media.opengl.*;
-import com.jogamp.newt.ScreenMode;
+import com.jogamp.newt.MonitorMode;
/**
* JoglCommon
@@ -61,7 +61,7 @@ public abstract class JoglES1Driver extends JoglGL2ES1 implements GLDriver {
public abstract String getName();
- public List<ScreenMode> getModeList() {
+ public List<MonitorMode> getModeList() {
if(null == newtWin) {
throw new RuntimeException("NEWTWin not yet initialized.");
}
diff --git a/src/jake2/render/opengl/JoglES2Driver.java b/src/jake2/render/opengl/JoglES2Driver.java
index 3d63984..2548b62 100644
--- a/src/jake2/render/opengl/JoglES2Driver.java
+++ b/src/jake2/render/opengl/JoglES2Driver.java
@@ -35,7 +35,7 @@ import jake2.render.Base;
import javax.media.nativewindow.util.Dimension;
import javax.media.opengl.*;
-import com.jogamp.newt.ScreenMode;
+import com.jogamp.newt.MonitorMode;
import com.jogamp.opengl.util.glsl.fixedfunc.FixedFuncUtil;
import com.jogamp.opengl.util.glsl.fixedfunc.ShaderSelectionMode;
@@ -66,7 +66,7 @@ public abstract class JoglES2Driver extends JoglGL2ES1 implements GLDriver {
public abstract String getName();
- public List<ScreenMode> getModeList() {
+ public List<MonitorMode> getModeList() {
if(null == newtWin) {
throw new RuntimeException("NEWTWin not yet initialized.");
}
diff --git a/src/jake2/render/opengl/JoglGL2Driver.java b/src/jake2/render/opengl/JoglGL2Driver.java
index 1fdcc8b..cad9c0a 100644
--- a/src/jake2/render/opengl/JoglGL2Driver.java
+++ b/src/jake2/render/opengl/JoglGL2Driver.java
@@ -35,7 +35,7 @@ import jake2.render.Base;
import javax.media.nativewindow.util.Dimension;
import javax.media.opengl.*;
-import com.jogamp.newt.ScreenMode;
+import com.jogamp.newt.MonitorMode;
/**
* JoglCommon
@@ -61,7 +61,7 @@ public abstract class JoglGL2Driver extends JoglGL2ES1 implements GLDriver {
public abstract String getName();
- public List<ScreenMode> getModeList() {
+ public List<MonitorMode> getModeList() {
if(null == newtWin) {
throw new RuntimeException("NEWTWin not yet initialized.");
}
diff --git a/src/jake2/render/opengl/NEWTWin.java b/src/jake2/render/opengl/NEWTWin.java
index 2afecc4..bc514ed 100644
--- a/src/jake2/render/opengl/NEWTWin.java
+++ b/src/jake2/render/opengl/NEWTWin.java
@@ -28,36 +28,37 @@ import javax.media.opengl.GLProfile;
import jogamp.opengl.FPSCounterImpl;
import com.jogamp.common.os.Platform;
-import com.jogamp.newt.NewtFactory;
-import com.jogamp.newt.Screen;
-import com.jogamp.newt.ScreenMode;
+import com.jogamp.newt.*;
import com.jogamp.newt.event.WindowAdapter;
import com.jogamp.newt.event.WindowEvent;
import com.jogamp.newt.opengl.GLWindow;
-import com.jogamp.newt.util.MonitorMode;
-import com.jogamp.newt.util.ScreenModeUtil;
+import com.jogamp.newt.util.MonitorModeUtil;
import com.jogamp.opengl.GenericGLCapabilitiesChooser;
public class NEWTWin {
- ScreenMode oldDisplayMode = null;
+ MonitorMode oldDisplayMode = null;
volatile Screen screen = null;
volatile GLWindow window = null;
final FPSCounterImpl fpsCounter = new FPSCounterImpl();
- public List<ScreenMode> getModeList() {
- return screen.getScreenModes();
+ public List<MonitorMode> getModeList() {
+ if( null != window ) {
+ final MonitorDevice mainMonitor = window.getMainMonitor();
+ return mainMonitor.getSupportedModes();
+ } else {
+ return screen.getMonitorModes();
+ }
}
- public ScreenMode findDisplayMode(DimensionImmutable dim) {
- final List<ScreenMode> sml = ScreenModeUtil.filterByResolution(screen.getScreenModes(), dim);
+ public MonitorMode findDisplayMode(DimensionImmutable dim) {
+ final List<MonitorMode> sml = MonitorModeUtil.filterByResolution(getModeList(), dim);
if(sml.size() == 0) {
return oldDisplayMode;
}
return sml.get(0);
}
- public String getModeString(ScreenMode sm) {
- final MonitorMode mm = sm.getMonitorMode();
+ public String getModeString(MonitorMode mm) {
final SurfaceSize ss = mm.getSurfaceSize();
final DimensionImmutable m = ss.getResolution();
final StringBuffer sb = new StringBuffer();
@@ -122,7 +123,9 @@ public class NEWTWin {
window.addWindowListener(new WindowAdapter() {
public void windowDestroyNotify(WindowEvent e) {
if (!Globals.appletMode) {
- Cbuf.ExecuteText(Defines.EXEC_APPEND, "quit");
+ if( null != window ) { // already in shutdown ?
+ Cbuf.ExecuteText(Defines.EXEC_APPEND, "quit");
+ }
}
}
@@ -132,8 +135,10 @@ public class NEWTWin {
});
window.setTitle("Jake2 ("+driverName+"-newt-"+glp.getName().toLowerCase()+")");
+ final MonitorDevice mainMonitor = window.getMainMonitor();
+
if (oldDisplayMode == null) {
- oldDisplayMode = window.getScreen().getCurrentScreenMode();
+ oldDisplayMode = mainMonitor.getCurrentMode();
}
// We need to feed the NEWT Window to the NEWTKBD
@@ -144,11 +149,11 @@ public class NEWTWin {
window.addMouseListener(NEWTKBD.listener);
if (fullscreen) {
- ScreenMode sm = findDisplayMode(newDim);
- final DimensionImmutable smDim = sm.getMonitorMode().getSurfaceSize().getResolution();
+ MonitorMode mm = findDisplayMode(newDim);
+ final DimensionImmutable smDim = mm.getSurfaceSize().getResolution();
newDim.setWidth( smDim.getWidth() );
newDim.setHeight( smDim.getHeight() );
- window.getScreen().setCurrentScreenMode(sm);
+ mainMonitor.setCurrentMode(mm);
window.setFullscreen(true);
} else {
window.setSize(newDim.getWidth(), newDim.getHeight());
@@ -222,12 +227,9 @@ public class NEWTWin {
private void shutdownImpl(boolean withScreen) {
if ( null != window ) {
deactivateGLContext();
- if (!Globals.appletMode) {
- window.destroy();
- } else {
- window.destroy(); // same thing
- }
+ final GLWindow _window = window;
window = null;
+ _window.destroy(); // same thing
}
if( withScreen && null != screen ) {
screen.destroy();