GLCapabilitiesChooser result should be between 1 and 6

All,

My application crashes with the following exception:

Exception in thread "main" javax.media.opengl.GLException: Invalid result 11 from GLCapabilitiesChooser (should be between 1 and 6)
	at com.sun.opengl.impl.windows.wgl.WindowsWGLGraphicsConfigurationFactory.updateGraphicsConfiguration(WindowsWGLGraphicsConfigurationFactory.java:264)
	at com.sun.opengl.impl.windows.wgl.WindowsWGLGraphicsConfiguration.updateGraphicsConfiguration(WindowsWGLGraphicsConfiguration.java:92)
	at com.sun.opengl.impl.windows.wgl.WindowsWGLDrawable.setRealized(WindowsWGLDrawable.java:76)
	at javax.media.opengl.awt.GLCanvas.addNotify(GLCanvas.java:413)
	at java.awt.Container.addNotify(Unknown Source)
	at javax.swing.JComponent.addNotify(Unknown Source)
	at java.awt.Container.addNotify(Unknown Source)
	at javax.swing.JComponent.addNotify(Unknown Source)
	at java.awt.Container.addNotify(Unknown Source)
	at javax.swing.JComponent.addNotify(Unknown Source)
	at javax.swing.JRootPane.addNotify(Unknown Source)
	at java.awt.Container.addNotify(Unknown Source)
	at java.awt.Window.addNotify(Unknown Source)
	at java.awt.Frame.addNotify(Unknown Source)
	at java.awt.Window.show(Unknown Source)
	at java.awt.Component.show(Unknown Source)
	at java.awt.Component.setVisible(Unknown Source)
	at java.awt.Window.setVisible(Unknown Source)
	at driver.Driver.main(Driver.java:106)

Why should the result be between 1 and 6? I am certain that my machine supports the capabilities I have requested.

Thank you,
Robert

Which capabilities have you requested?

Gouessej,

I have requested setSampleBuffers(true) and setNumSamples(2).

Thank you,
Robert

Ok you try to use FSAA, it should not crash, it should disable FSAA silently if not available, it is a regression on my view. Which graphics card do you have?

Gouessej,

I have an ATI Mobility Radeon 9700.

Thank you,
Robert

Your graphics card has 6 samples. What happens when you increase the sample count (setNumSamples(6))?

I have almost the same graphics card at home (ATI Radeon 9250 Pro) that supports 2 to 6 samples. Can you provide me a tiny test case to reproduce your bug?

Gouessej,

I have attached a zip (renamed txt) containing a program that crashes with the exception. Note the build and run scripts set the classpath to jogl jars in the current directory, I would have included them in the zip, but that would be over 1500KB.

Thank you,
Robert

Gouessej,

Requesting 4 samples crashes with result 12 should be between 1 and 4. Requesting 6 samples crashes with result 13 should be between 1 and 2.

Thank you,
Robert

Gouessej,

I have tested this on another machine with a NVIDIA Quadro FX 3450/4000 SDI card. This card supports on up to 6 sample buffers as well. My application will crash on this machine if I request a sample buffer count other than 2. Also, if I include the following in my requests, the program will crash even when requesting 2 sample buffers.

capabilities.setBackgroundOpaque(false);
capabilities.setAlphaBits(8);

Thank you,
Robert

Ok I will give it a try as soon as possible. I hope it is reproducible under Linux as I have still no access to Windows.

Hi, this problem sounds familiar to me.
I use the JOGL 2.0 AMD64 binaries on a NVidia GTX 260m (supporting 16x FSAA) and I get the following errors for each FSAA sample buffer size using a glCanvas (it is all fine for a glJPanel):

at com.sun.opengl.impl.windows.wgl.WindowsWGLGraphicsConfigurationFactory.updateGraphicsConfiguration(WindowsWGLGraphicsConfigurationFactory.java:264)

0,1,2: ok
4: Invalid result 31 from GLCapabilitiesChooser (should be between 1 and 24)
8: Invalid result 43 from GLCapabilitiesChooser (should be between 1 and 16)
16: Invalid result 55 from GLCapabilitiesChooser (should be between 1 and 8)

Yes it is the same problem. I’m sorry, I’m currently very busy but I will try to fix it when I have some spare time.

Edit.: my home computer is a bit broken, it does not help…

I and my colleagues have the same issue on various Windows versions and JOGL 2

The problem seems to be that wglChoosePixelFormatARB in WindowsWGLGraphicsConfigurationFactory.updateGraphicsConfiguration returns a number of pixel formats that is less than the nr of available capabilities returned by WindowsWGLGraphicsConfiguration.HDC2GLCapabilities. The recommended pixel format passed on to the chooser (and which is always returned by it) seems always greater than numFormats for us. If we set more than 2 samples it causes: throw new GLException("Invalid result " + pixelFormat + " from GLCapabilitiesChooser (should be between 1 and " + numFormats + “)”);

I hope this may help a bit in finding out why it actually happens cause that I unfortunately do not know yet.

Thank you. It helps a lot as I have no machine under Windows to reproduce this bug.

That must be a bit hard to fix a problem you can’t reproduce. Just ask if you need some more info or need something tested.

Thanks. In my humble opinion, it is a regression between JOGL 1.1.2 and JOGL 2.

All,

 Where should this bug be posted so that it can receive more attention?

Thank you,
Robert

hi Robert,
sorry for the delay. So you are using JOGL 2? Could you try one of those builds (I hope you are not on a mac ;)) and report back if it still happens.

bienator,

 I am using JOGL 2 and Windows XP.  With the suggested build, my application crashes on:
capabilities = new GLCapabilities(GLProfile.getDefault());

The stack trace is:

Exception in thread "main" java.lang.ExceptionInInitializerError
	at javax.media.opengl.GLProfile.<clinit>(GLProfile.java:895)
	at graphics.canvas.factory.GLCanvasFactory.create(GLCanvasFactory.java:33)
	at graphics.canvas.factory.GLCanvasFactory.create(GLCanvasFactory.java:15)
	at xml.XMLLoader.handleXML(XMLLoader.java:57)
	at xml.XMLDistributor.handleXML(XMLDistributor.java:45)
	at xml.XMLFileLoader.loadFile(XMLFileLoader.java:57)
	at xml.XMLFileLoader.handleXML(XMLFileLoader.java:41)
	at xml.XMLDistributor.handleXML(XMLDistributor.java:45)
	at xml.XMLFileLoader.loadFile(XMLFileLoader.java:57)
	at driver.Driver.main(Driver.java:83)
Caused by: javax.media.opengl.GLException: Error freeing OpenGL context: 0x0
	at com.jogamp.opengl.impl.windows.wgl.WindowsWGLContext.releaseImpl(WindowsWGLContext.java:338)
	at com.jogamp.opengl.impl.GLContextImpl.release(GLContextImpl.java:160)
	at com.jogamp.opengl.impl.windows.wgl.WindowsWGLDrawableFactory.<init>(WindowsWGLDrawableFactory.java:80)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
	at java.lang.reflect.Constructor.newInstance(Unknown Source)
	at com.jogamp.common.util.ReflectionUtil.createInstance(ReflectionUtil.java:118)
	at com.jogamp.common.util.ReflectionUtil.createInstance(ReflectionUtil.java:148)
	at com.jogamp.common.util.ReflectionUtil.createInstance(ReflectionUtil.java:167)
	at javax.media.opengl.GLDrawableFactory.<clinit>(GLDrawableFactory.java:136)
	... 10 more

Thank you,
Robert