JOGL v2.6.0-rc-20250706
JOGL, High-Performance Graphics Binding for Java™ (public API).
com.jogamp.newt.MonitorMode Class Reference

Immutable MonitorMode Class, consisting of it's read only components:
More...

Inheritance diagram for com.jogamp.newt.MonitorMode:
Collaboration diagram for com.jogamp.newt.MonitorMode:

Classes

class  SizeAndRRate
 Immutable surfaceSize, flags and refreshRate Class, consisting of it's read only components:
More...
 

Public Member Functions

 MonitorMode (final int nativeId, final SizeAndRRate sizeAndRRate, final int rotation)
 
 MonitorMode (final SurfaceSize surfaceSize, final float refreshRate, final int flags, final int rotation)
 Creates a user instance w/o identity to filter our matching modes w/ identity. More...
 
final int getId ()
 
final SizeAndRRate getSizeAndRRate ()
 Returns the surfaceSize and refreshRate instance. More...
 
final SurfaceSize getSurfaceSize ()
 Returns the unrotated SurfaceSize. More...
 
final float getRefreshRate ()
 Returns the vertical refresh rate. More...
 
final int getFlags ()
 Returns bitfield w/ flags, i.e. More...
 
final int getRotation ()
 Returns the CCW rotation of this mode. More...
 
final int getRotatedWidth ()
 Returns the rotated screen width in pixel units, derived from getMonitorMode().getSurfaceSize().getResolution() and getRotation() More...
 
final int getRotatedHeight ()
 Returns the rotated screen height in pixel units, derived from getMonitorMode().getSurfaceSize().getResolution() and getRotation() More...
 
final String toString ()
 
int compareTo (final MonitorMode mm)
 
final boolean equals (final Object obj)
 Tests equality of two MonitorMode objects by evaluating equality of it's components:
More...
 
final int hashCode ()
 Returns a combined hash code of it's elements:
More...
 

Static Public Member Functions

static boolean isRotationValid (final int rotation)
 

Static Public Attributes

static final Comparator< MonitorModemonitorModeComparator
 Comparator for 2 MonitorModes, following comparison order as described in MonitorMode#compareTo(MonitorMode), returning the ascending order. More...
 
static final Comparator< MonitorModemonitorModeComparatorInv
 Comparator for 2 MonitorModes, following comparison order as described in MonitorMode#compareTo(MonitorMode), returning the descending order. More...
 
static final int ROTATE_0 = 0
 zero rotation, compared to normal settings More...
 
static final int ROTATE_90 = 90
 90 degrees CCW rotation More...
 
static final int ROTATE_180 = 180
 180 degrees CCW rotation More...
 
static final int ROTATE_270 = 270
 270 degrees CCW rotation More...
 
static final int FLAG_INTERLACE = 1 << 0
 Frame is split into two fields. More...
 
static final int FLAG_DOUBLESCAN = 1 << 1
 Lines are doubled. More...
 

Detailed Description

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

Aquire and filter MonitorMode


Changing MonitorMode


Example for changing the MonitorMode:

     // Pick the monitor:
     // Either the one used by a window ..
     MonitorDevice monitor = window.getMainMonitor();

     // Or arbitrary from the list ..
     List<MonitorDevice> allMonitor = getMonitorDevices();
     MonitorDevice monitor = allMonitor.get(0);

     // Current and original modes ..
     MonitorMode mmCurrent = monitor.queryCurrentMode();
     MonitorMode mmOrig = monitor.getOriginalMode();

     // Target resolution in pixel units
     DimensionImmutable res = new Dimension(800, 600);

     // Target refresh rate shall be similar to current one ..
     float freq = mmCurrent.getRefreshRate();

     // Target rotation shall be similar to current one
     int rot = mmCurrent.getRotation();

     // Filter criterias sequential out of all available MonitorMode of the chosen MonitorDevice
     List<MonitorMode> monitorModes = monitor.getSupportedModes();
     monitorModes = MonitorModeUtil.filterByFlags(monitorModes, 0); // no interlace, double-scan etc
     monitorModes = MonitorModeUtil.filterByRotation(monitorModes, rot);
     monitorModes = MonitorModeUtil.filterByResolution(monitorModes, res);
     monitorModes = MonitorModeUtil.filterByRate(monitorModes, freq);
     monitorModes = MonitorModeUtil.getHighestAvailableBpp(monitorModes);

     // pick 1st one and set to current ..
     MonitorMode mm = monitorModes.get(0);
     monitor.setCurrentMode(mm);

Definition at line 113 of file MonitorMode.java.

Constructor & Destructor Documentation

◆ MonitorMode() [1/2]

com.jogamp.newt.MonitorMode.MonitorMode ( final int  nativeId,
final SizeAndRRate  sizeAndRRate,
final int  rotation 
)
Parameters
sizeAndRRatethe surface size and refresh rate mode
rotationthe screen rotation, measured counter clockwise (CCW)

Definition at line 300 of file MonitorMode.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MonitorMode() [2/2]

com.jogamp.newt.MonitorMode.MonitorMode ( final SurfaceSize  surfaceSize,
final float  refreshRate,
final int  flags,
final int  rotation 
)

Creates a user instance w/o identity to filter our matching modes w/ identity.

See com.jogamp.newt.util.MonitorModeUtil for filter utilities.

Parameters
surfaceSize
refreshRate
flags
rotation

Definition at line 320 of file MonitorMode.java.

Member Function Documentation

◆ compareTo()

int com.jogamp.newt.MonitorMode.compareTo ( final MonitorMode  mm)

Compares sizeAndRRate 1st, then rotation.

Rotation is compared inverted, i.e. 360 - rotation, so the lowest rotation reflects a higher value.

Order of comparing MonitorMode:

  • resolution
  • bits per pixel
  • flags
  • refresh rate
  • rotation

Definition at line 394 of file MonitorMode.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ equals()

final boolean com.jogamp.newt.MonitorMode.equals ( final Object  obj)

Tests equality of two MonitorMode objects by evaluating equality of it's components:

  • nativeId
  • sizeAndRRate
  • rotation

Definition at line 419 of file MonitorMode.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getFlags()

final int com.jogamp.newt.MonitorMode.getFlags ( )

Returns bitfield w/ flags, i.e.

FLAG_DOUBLESCAN, FLAG_INTERLACE, ..

Definition at line 343 of file MonitorMode.java.

Here is the caller graph for this function:

◆ getId()

final int com.jogamp.newt.MonitorMode.getId ( )
Returns
the immutable native Id of this mode, may not be unique, may be 0.

Definition at line 325 of file MonitorMode.java.

Here is the caller graph for this function:

◆ getRefreshRate()

final float com.jogamp.newt.MonitorMode.getRefreshRate ( )

Returns the vertical refresh rate.

Definition at line 338 of file MonitorMode.java.

Here is the caller graph for this function:

◆ getRotatedHeight()

final int com.jogamp.newt.MonitorMode.getRotatedHeight ( )

Returns the rotated screen height in pixel units, derived from getMonitorMode().getSurfaceSize().getResolution() and getRotation()

Definition at line 364 of file MonitorMode.java.

◆ getRotatedWidth()

final int com.jogamp.newt.MonitorMode.getRotatedWidth ( )

Returns the rotated screen width in pixel units, derived from getMonitorMode().getSurfaceSize().getResolution() and getRotation()

Definition at line 356 of file MonitorMode.java.

◆ getRotation()

final int com.jogamp.newt.MonitorMode.getRotation ( )

Returns the CCW rotation of this mode.

Definition at line 348 of file MonitorMode.java.

Here is the caller graph for this function:

◆ getSizeAndRRate()

final SizeAndRRate com.jogamp.newt.MonitorMode.getSizeAndRRate ( )

Returns the surfaceSize and refreshRate instance.

Definition at line 328 of file MonitorMode.java.

Here is the caller graph for this function:

◆ getSurfaceSize()

final SurfaceSize com.jogamp.newt.MonitorMode.getSurfaceSize ( )

Returns the unrotated SurfaceSize.

Definition at line 333 of file MonitorMode.java.

Here is the caller graph for this function:

◆ hashCode()

final int com.jogamp.newt.MonitorMode.hashCode ( )

Returns a combined hash code of it's elements:

  • nativeId
  • sizeAndRRate
  • rotation

Definition at line 439 of file MonitorMode.java.

◆ isRotationValid()

static boolean com.jogamp.newt.MonitorMode.isRotationValid ( final int  rotation)
static

Definition at line 291 of file MonitorMode.java.

Here is the caller graph for this function:

◆ toString()

final String com.jogamp.newt.MonitorMode.toString ( )

Definition at line 369 of file MonitorMode.java.

Here is the call graph for this function:

Member Data Documentation

◆ FLAG_DOUBLESCAN

final int com.jogamp.newt.MonitorMode.FLAG_DOUBLESCAN = 1 << 1
static

Lines are doubled.

See getFlags().

Definition at line 283 of file MonitorMode.java.

◆ FLAG_INTERLACE

final int com.jogamp.newt.MonitorMode.FLAG_INTERLACE = 1 << 0
static

Frame is split into two fields.

See getFlags().

Definition at line 280 of file MonitorMode.java.

◆ monitorModeComparator

final Comparator<MonitorMode> com.jogamp.newt.MonitorMode.monitorModeComparator
static
Initial value:
= new Comparator<MonitorMode>() {
@Override
public int compare(final MonitorMode mm1, final MonitorMode mm2) {
return mm1.compareTo(mm2);
} }
MonitorMode(final int nativeId, final SizeAndRRate sizeAndRRate, final int rotation)

Comparator for 2 MonitorModes, following comparison order as described in MonitorMode#compareTo(MonitorMode), returning the ascending order.

Definition at line 116 of file MonitorMode.java.

◆ monitorModeComparatorInv

final Comparator<MonitorMode> com.jogamp.newt.MonitorMode.monitorModeComparatorInv
static
Initial value:
= new Comparator<MonitorMode>() {
@Override
public int compare(final MonitorMode mm1, final MonitorMode mm2) {
return mm2.compareTo(mm1);
} }

Comparator for 2 MonitorModes, following comparison order as described in MonitorMode#compareTo(MonitorMode), returning the descending order.

Definition at line 123 of file MonitorMode.java.

◆ ROTATE_0

final int com.jogamp.newt.MonitorMode.ROTATE_0 = 0
static

zero rotation, compared to normal settings

Definition at line 268 of file MonitorMode.java.

◆ ROTATE_180

final int com.jogamp.newt.MonitorMode.ROTATE_180 = 180
static

180 degrees CCW rotation

Definition at line 274 of file MonitorMode.java.

◆ ROTATE_270

final int com.jogamp.newt.MonitorMode.ROTATE_270 = 270
static

270 degrees CCW rotation

Definition at line 277 of file MonitorMode.java.

◆ ROTATE_90

final int com.jogamp.newt.MonitorMode.ROTATE_90 = 90
static

90 degrees CCW rotation

Definition at line 271 of file MonitorMode.java.


The documentation for this class was generated from the following file: