Hi
I get the following error when i try to start my school project after upgrading to x.org 7.4:
Exception in thread “main” java.lang.IllegalArgumentException: Invalid display mode
at sun.awt.X11GraphicsDevice.setDisplayMode(X11GraphicsDevice.java:362)
at saau.Main.(Main.java:262)
at saau.Main.main(Main.java:41)
I think i have to set the display mode but i don’t know how. And i don’t have fullscreen in opengl.
The facts:
The opengl-window/Display is in an SwingFrame (Screenshot with X.org 7.3 :http://img257.imageshack.us/my.php?image=openglswingen4.jpg)
Jogl-Version: 1.1.1
X.org: 7.4
A Little Code:
Main:
JPopupMenu.setDefaultLightWeightPopupEnabled(false);
GLCapabilities cap = new GLCapabilities();
// früher: canvas = GLDrawableFactory.getFactory().createGLCanvas(cap);
// jetzt:
canvas = new GLCanvas(cap);
//canvas.setSize(400, 500);
canvas.addGLEventListener(new DrawGL(this, intMenuPanelTop));
canvas.setSize(DEFAULTDM.getWidth(), DEFAULTDM.getHeight());
canvas.addMouseListener(this);
canvas.addMouseMotionListener(this);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// setSize(600,600);
this.setUndecorated(true); // Fullscreen
GraphicsDevice myGraphicsDevice = GraphicsEnvironment
.getLocalGraphicsEnvironment().getDefaultScreenDevice();
myGraphicsDevice.setFullScreenWindow(this);
if (myGraphicsDevice.isDisplayChangeSupported()) {
DisplayMode myDisplayMode = new DisplayMode(intSizeX, intSizeY, 24,
DisplayMode.REFRESH_RATE_UNKNOWN);
myGraphicsDevice.setDisplayMode(myDisplayMode);
}
JLabel lbLoading = new JLabel("Loading .... Please wait ....");
lbLoading.setBounds((intSizeX - 500) / 2, (intSizeY - 30) / 2, 500, 40);
lbLoading.setFont(new Font("SansSerif", Font.BOLD, 36));
this.add(lbLoading);
// Dimension fullScreen = Toolkit.getDefaultToolkit().getScreenSize();
// GraphicsDevice… (the same as above)
// this.setSize(fullScreen);
// initialisierung
this.setSize(intSizeX, intSizeY); // größe setezn
// this.add(new JButton("Button"), BorderLayout.NORTH);
setLayout(null); // layout auf null setzen
// panles und menüs erstellen
menuPanelRight = new JPanel();
menuPanelRight.setBounds(intSizeX - intMenuPanelRight, 0,
intMenuPanelRight, intSizeY);
menuPanelRight.setLayout(null);
// Hintergrudfarbe für das Menü
menuPanelRight.setBackground(new Color(47, 51, 87));
menuPanelRight.setBorder(BorderFactory.createLoweredBevelBorder());
menuPanelRight.setVisible(false);
menuPanelTop = new JPanel();
menuPanelTop.setBounds(0, 0, intSizeX - intMenuPanelRight,
intMenuPanelTop);
menuPanelTop.setLayout(null);
menuPanelTop.setBorder(BorderFactory.createLoweredBevelBorder());
menuPanelTop.setBackground(new Color(47, 51, 87));
menuPanelTop.setVisible(false);
this.add(menuPanelRight);
this.add(menuPanelTop);
// Füge zeichenoberfläche in die swing komponente ein.
// this.add(new Draw(this));
init_Menu();// OBERES MENÜ
this.add(canvas);
canvas.setBounds(0, intMenuPanelTop, intSizeX - intMenuPanelRight,
intSizeY - intMenuPanelTop); // / ERROR
// canvas.setBounds(0, 0, 100, 100);
canvas.setVisible(false);
How can i fix that error? Thanks in advance. I really need Help because it is an School Project.
If you need any further infomation please ask.
Linuxuser