com.jogamp.newt
Class ScreenMode

java.lang.Object
  extended by com.jogamp.newt.ScreenMode

public class ScreenMode
extends Object

Immutable ScreenMode Class, consisting of it's read only components:

Aquire and filter ScreenModes

Changing ScreenModes

Example for changing the ScreenMode:
        // 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

X11 / NVidia difficulties
    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"
 


Field Summary
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 Summary
ScreenMode(MonitorMode monitorMode, int rotation)
           
 
Method Summary
 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()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ROTATE_0

public static final int ROTATE_0
zero rotation, compared to normal settings

See Also:
Constant Field Values

ROTATE_90

public static final int ROTATE_90
90 degrees CCW rotation

See Also:
Constant Field Values

ROTATE_180

public static final int ROTATE_180
180 degrees CCW rotation

See Also:
Constant Field Values

ROTATE_270

public static final int ROTATE_270
270 degrees CCW rotation

See Also:
Constant Field Values
Constructor Detail

ScreenMode

public ScreenMode(MonitorMode monitorMode,
                  int rotation)
Parameters:
monitorMode - the monitor mode
rotation - the screen rotation, measured counter clockwise (CCW)
Method Detail

isRotationValid

public static boolean isRotationValid(int rotation)

getMonitorMode

public final MonitorMode getMonitorMode()
Returns the unrotated MonitorMode


getRotation

public final int getRotation()
Returns the CCW rotation of this mode


getRotatedWidth

public final int getRotatedWidth()
Returns the rotated screen width, derived from getMonitorMode().getSurfaceSize().getResolution() and getRotation()


getRotatedHeight

public final int getRotatedHeight()
Returns the rotated screen height, derived from getMonitorMode().getSurfaceSize().getResolution() and getRotation()


toString

public final String toString()
Overrides:
toString in class Object

equals

public final boolean equals(Object obj)
Tests equality of two ScreenMode objects by evaluating equality of it's components:

Overrides:
equals in class Object

hashCode

public final int hashCode()
Returns a combined hash code of it's elements:

Overrides:
hashCode in class Object


Copyright 2010 JogAmp Community.