public class ScreenMode extends Object
MonitorMode, non rotated valuesrotation, measured counter clockwise (CCW)Screen.getScreenModes().ScreenModeUtil to filter and select a desired ScreenMode.Screen.getCurrentScreenMode().Screen.getOriginalScreenMode().Screen.setCurrentScreenMode(com.jogamp.newt.ScreenMode)Screen.getFQName().
Screen.getOriginalScreenMode())
is restored.
// determine target refresh rate
ScreenMode orig = screen.getOriginalScreenMode();
int freq = orig.getMonitorMode().getRefreshRate();
// target resolution
Dimension res = new Dimension(800, 600);
// target rotation
int rot = 0;
// filter available ScreenModes
List screenModes = screen.getScreenModes();
screenModes = ScreenModeUtil.filterByRate(screenModes, freq); // get the nearest ones
screenModes = ScreenModeUtil.filterByRotation(screenModes, rot);
screenModes = ScreenModeUtil.filterByResolution(screenModes, res); // get the nearest ones
screenModes = ScreenModeUtil.getHighestAvailableBpp(screenModes);
// pick 1st one ..
screen.setCurrentScreenMode((ScreenMode) screenModes.get(0));
X11 / AMD just works
NVidia RANDR RefreshRate Bug
If NVidia's 'DynamicTwinView' is enabled, all refresh rates are
unique, ie consequent numbers starting with the default refresh, ie 50, 51, ..
The only way to workaround it is to disable 'DynamicTwinView'.
Read: http://us.download.nvidia.com/XFree86/Linux-x86/260.19.12/README/configtwinview.html
Check to see if 'DynamicTwinView' is enable:
nvidia-settings -q :0/DynamicTwinview
To disable it (workaround), add the following option to your xorg.conf device section:
Option "DynamicTwinView" "False"
NVidia RANDR Rotation:
To enable it, add the following option to your xorg.conf device section:
Option "RandRRotation" "on"
| Modifier and Type | Field and Description |
|---|---|
static int |
ROTATE_0
zero rotation, compared to normal settings
|
static int |
ROTATE_180
180 degrees CCW rotation
|
static int |
ROTATE_270
270 degrees CCW rotation
|
static int |
ROTATE_90
90 degrees CCW rotation
|
| Constructor and Description |
|---|
ScreenMode(MonitorMode monitorMode,
int rotation) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj)
Tests equality of two
ScreenMode objects
by evaluating equality of it's components:monitorMode
rotation
|
MonitorMode |
getMonitorMode()
Returns the unrotated
MonitorMode |
int |
getRotatedHeight()
Returns the rotated screen height,
derived from
getMonitorMode().getSurfaceSize().getResolution()
and getRotation() |
int |
getRotatedWidth()
Returns the rotated screen width,
derived from
getMonitorMode().getSurfaceSize().getResolution()
and getRotation() |
int |
getRotation()
Returns the CCW rotation of this mode
|
int |
hashCode()
Returns a combined hash code of it's elements:
monitorMode
rotation
|
static boolean |
isRotationValid(int rotation) |
String |
toString() |
public static final int ROTATE_0
public static final int ROTATE_90
public static final int ROTATE_180
public static final int ROTATE_270
public ScreenMode(MonitorMode monitorMode, int rotation)
monitorMode - the monitor moderotation - the screen rotation, measured counter clockwise (CCW)public static boolean isRotationValid(int rotation)
public final MonitorMode getMonitorMode()
MonitorModepublic final int getRotation()
public final int getRotatedWidth()
getMonitorMode().getSurfaceSize().getResolution()
and getRotation()public final int getRotatedHeight()
getMonitorMode().getSurfaceSize().getResolution()
and getRotation()public final boolean equals(Object obj)
ScreenMode objects
by evaluating equality of it's components:monitorModerotationCopyright 2010 JogAmp Community.