- Forward


Full-Screen Exclusive Graphics
An Introduction with Examples in Java


Prof. David Bernstein
James Madison University

Computer Science Department
bernstdh@jmu.edu

Print

Motivation
Back SMYC Forward
  • Graphics is complicated considerably by "windowing"
  • As a result, the performance of graphical systems is hampered by "windowing"
  • One way around this problem is for a single graphical application to take control of the entire screen
Concepts
Back SMYC Forward
  • Environment:
    • A description of the overall capabilities of the system. In Java, an environment is encapsulated by the GraphicsEnvironment class
  • Device:
    • A display device (usually a monitor, printer, or plotter). In Java, a device is encapsulated by the GraphicsDevice class.
  • Configuration:
    • The settings for a particular device (e.g., resolution, color depth). In Java, a configuration is encapsulated by the GraphicsConfiguration class.
Issues
Back SMYC Forward
  • Display Mode:
    • It is not always possible to change the display mode on the fly, and this makes full-screen graphics cumbersome
    • If the display mode is the same color depth as the screen then the colors will not have to be dithered, and this is usually much more efficient
  • Page Flipping:
    • The screen has a video pointer and there are two (or more in the case of a multi-buffered system) images
    • This group of images is sometimes called a flip chain
Issues (cont.)
Back SMYC Forward
  • Image Acceleration:
    • In some system, an image can be accelerated in a variety of ways including including pixmaps, Video RAM (VRAM), and Accelerated Graphics Port (AGP)
  • Volatility of Images:
    • A "volatile image" (which is encapsulated in Java by the VolatileImage class) is subject to losing its contents at any time in ways that are beyond the control of the application (e.g., situations caused by the operating system or by other applications).
    • Volatile images are required by some kinds of acceleration.
Capabilities
Back SMYC Forward
javaexamples/fullscreen/ShowCapabilities.java
 
Animation
Back SMYC Forward
  • Up until now, the "rendering" loop was under the control of the OS.
  • With full-screen exclusive mode graphics, it is completely controlled by the application.
Animation (cont.)
Back SMYC Forward

Without a Buffer Strategy

Graphics g = getPaintGraphics(); while (!done) { // Rendering using g } g.dispose();
Animation (cont.)
Back SMYC Forward

With a Buffer Strategy

BufferStrategy strategy; Window window; // Construct the Window // Create the BufferStrategy window.createBufferStrategy(2); strategy = window.getBufferStrategy(); Graphics g = strategy.getDrawGraphics(); while (!done) { // Rendering using g strategy.show(); } g.dispose();
An Example
Back SMYC Forward

The Stage Revisited

javaexamples/fullscreen/FullScreenStage.java
 
There's Always More to Learn
Back -