Invalid display mode on Ubuntu8.10 X.org 7.4

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

This part of the code might cause some problems:

DisplayMode myDisplayMode = new DisplayMode(intSizeX, intSizeY, 24,
					DisplayMode.REFRESH_RATE_UNKNOWN);

This is not a bug. You should check if this display mode is available before using it by using the method below in the class GraphicsDevice:

[quote] DisplayMode[] getDisplayModes()
Returns all display modes available for this GraphicsDevice.
[/quote]
Under Linux, the bit depth is often DisplayMode.BIT_DEPTH_MULTI rather than 24. If you want your program to be cross-platform, use the method above rather than using this constant.

I advise you to read the Java Documentation before posting.

Hi

Thanks for the help. DisplayMode.BIT_DEPTH_MULTI does the trick. But now it starts but the OpenGL window is white. After restart all is fine. Why it the screen white in the first time. How can solve this ?

Thanks in advance.

PS: I grepped the doc for opengl and found not much and in my eyes not suitable for my problem.

Linuxuser

JOGL 1.1.1 relies on AWT for the display mode. I don’t know why it is white at the first time, I have to watch the code.