Is there some built-in technique in java for testing what GLCapabilities are supported by a GL context (tested either right before its created, or after)? I can think of a couple of ways to do it, but I was wondering if there’s already some functionality I’m unaware of…
It’s more something in JOGL rather than Java in general, but yes, if you implement the GLCapabilitiesChooser interface and pass an instance to for example the GLCanvas constructor you will get a callback which gives you all of the possible GLCapabilities which could be supported by the GLDrawable being created and lets you choose one. See for example the MultisampleChooser in the source code for demos.multisample.Multisample in the jogl-demos source tree.
That interface would be invaluable in Java2D for detecting if the openGL pipeline should be implemented or not. Why can’t it be included in the java.awt package ? (or as an inner class of java.awt.Graphics)
Lookat the jogl demo source archive in which the misc folder contain a little program that list all the available caps under jogl. I forgot what i called it.
Java2D is too abstract an API to tie it to OpenGL concepts. For example on Windows the default implementation uses DirectDraw rather than OpenGL. In my opinion it’s better to factor the Java/OpenGL binding into its own package.
Ah, yes - I meant JOGL where I typed Java there, but the method (and the demo) makes sense for checking as/before the window is gneerated. As far as I can tell, though, there is no way to check the GLCapabilities of a currently-active GL Context (i.e. a “getCapabilities” method in GLAutoDrawable or something like that…) - is this not possible, or was it just deemed unneccessary?
There is an RFE filed about this but it is non-trivial to implement on the Mac and due to this won’t be in the initial release of JSR-231. We plan to incorporate it soon after this release, though.