JDK-4806658 : 1.4.1 REGRESSION: "opengl initialization failure" when entering fullscreen mode
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 1.4.1
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_2000
  • CPU: x86
  • Submitted: 2003-01-22
  • Updated: 2003-01-27
  • Resolved: 2003-01-27
Related Reports
Duplicate :  
Description

Name: jk109818			Date: 01/22/2003


FULL PRODUCT VERSION :
java version "1.4.1_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_01-b01)
Java HotSpot(TM) Client VM (build 1.4.1_01-b01, mixed mode)

FULL OPERATING SYSTEM VERSION :

Microsoft Windows 2000 [Version 5.00.2195]

EXTRA RELEVANT SYSTEM CONFIGURATION :
ATI RAGE MOBILITY-P AGP2X
Driver File: Ati2drab.dll
  Release Version: M6.12.43-T03

A DESCRIPTION OF THE PROBLEM :
when entering full screen mode, the screen goes black
(although part of the task bar is visible), and a box
appears with the following message:

opengl initialization failure: the primary surface could
not be created

this happens on a game i'm developing, as well as on the
meatfighter game. however, this bug didn't show its face on
the 1.4.0_02 release, only the 1.4.1 releases. there are no
calls to opengl functions or libraries in my game (and i
assume there aren't any in meatfighter either as it's also
2d).

REGRESSION.  Last worked in version 1.4

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. try to run meatfighter and run it with a similar
configuration
(http://members.bellatlantic.net/~birken/meatfighteronline/)
OR
2. run this test case:

import java.awt.*;
import java.awt.image.BufferStrategy;

/**
 *
 * @author  Jackson Pauls
 * @version 0.1
 */
public class fsc extends javax.swing.JFrame {

    private static final Dimension WINDOW_SIZE = new Dimension(800, 600);
    
    public fsc() {
        setResizable(false);
        setUndecorated(true);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                exitForm(evt);
            }
        }); 
        initWindow();
        setIgnoreRepaint(true);
        requestFocusInWindow();
        createBufferStrategy(2);        
        setCursor(getToolkit().createCustomCursor(new java.awt.image.BufferedImage(1, 1, java.awt.image.BufferedImage.TYPE_4BYTE_ABGR),(new Point(0,0)),"HiddenM"));
    }
   
    private void exitForm(java.awt.event.WindowEvent evt) {
        if (isFullScreen) screen.setDisplayMode(originalDM);
        exitGame();
    }
    
    private void exitGame() {
        System.exit(0);
    }

    public static void main(String args[]) {
        new fsc();
    }
    
    private static boolean isFullScreen = false;
    private GraphicsDevice screen;
    private DisplayMode originalDM;
    private static DisplayMode[] BEST_DISPLAY_MODES = new DisplayMode[] {
        new DisplayMode(WINDOW_SIZE.width, WINDOW_SIZE.height, 16, DisplayMode.REFRESH_RATE_UNKNOWN),
        new DisplayMode(WINDOW_SIZE.width, WINDOW_SIZE.height, 32, DisplayMode.REFRESH_RATE_UNKNOWN),
        new DisplayMode(WINDOW_SIZE.width, WINDOW_SIZE.height, 24, DisplayMode.REFRESH_RATE_UNKNOWN),
        new DisplayMode(WINDOW_SIZE.width, WINDOW_SIZE.height, 8, DisplayMode.REFRESH_RATE_UNKNOWN)
    };
    
    public void initWindow() {
        GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
        screen = env.getDefaultScreenDevice();
        
        isFullScreen = screen.isFullScreenSupported();
        if (isFullScreen) {
            DisplayMode best = getBestDisplayMode(screen);
            if (best != null) {
                originalDM = screen.getDisplayMode();
                DisplayMode[] dms = screen.getDisplayModes();
                screen.setFullScreenWindow(this);
                validate();
                screen.setDisplayMode(best);
                return;
            }
            else isFullScreen = false;
        }
        // Windowed mode
        pack();
        setSize(WINDOW_SIZE);
        if (!isFullScreen) {
            Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
            setLocation((screenSize.width - WINDOW_SIZE.width) / 2, (screenSize.height - WINDOW_SIZE.height) / 2);
            setVisible(true);
        }
    }
    
    private static DisplayMode getBestDisplayMode(GraphicsDevice device) {
        for (int x = 0; x < BEST_DISPLAY_MODES.length; x++) {
            DisplayMode[] modes = device.getDisplayModes();
            for (int i = 0; i < modes.length; i++) {
                if (modes[i].getWidth() == BEST_DISPLAY_MODES[x].getWidth()
                && modes[i].getHeight() == BEST_DISPLAY_MODES[x].getHeight()
                && modes[i].getBitDepth() == BEST_DISPLAY_MODES[x].getBitDepth()
                ) {
                    return BEST_DISPLAY_MODES[x];
                }
            }
        }
        return null;
    }

    
}



EXPECTED VERSUS ACTUAL BEHAVIOR :
expected the game to run in full screen as on 1.4.0, got
error message instead

ERROR MESSAGES/STACK TRACES THAT OCCUR :
opengl initialization failure: the primary surface could not be created

REPRODUCIBILITY :
This bug can be reproduced always.

CUSTOMER WORKAROUND :
run the games in 1.4.0

Release Regression From : 1.4.0_02
The above release value was the last known release where this 
bug was known to work. Since then there has been a regression.

(Review ID: 178497) 
======================================================================

Comments
EVALUATION This bug is a duplicate of bug 4738111. I don't have appropriate hardware (ATI mobility) to verify this, but I know that that previous bug (fixed in upcoming releases 1.4.1_02 and 1.4.2) was caused by an erroneous call into OpenGL (via the pixel format functions) during SetDisplayMode(). Closing this bug as a duplicate of that earlier (fixed) bug. ###@###.### 2003-01-27
27-01-2003