non supported depth on some X11 server

it is possible to get a recommendedVis with GLX.glXChooseVisual
with a depth which is not supported by the awt.

this happens in com.sun.opengl.impl.x11.X11GLDrawableFactory at least with
(remote) display on sgi irix.

the recommended visual has a depth of 30 (32 bits are devided in 3x10 color bits and 2 alpha bits)

i made the following quick and dirty extension to X11GLDrawableFactory.java near line 168:

168 caps = new GLCapabilities[infos.length];
169 for (int i = 0; i < infos.length; i++) {
170 if (infos[i].depth() == 30 || infos[i].depth() == 12)
171 continue; //i.b. unsupported depth
172 caps[i] = xvi2GLCapabilities(display, infos[i]);
173 // Attempt to find the visual chosen by glXChooseVisual
174 if (recommendedVis != null && recommendedVis.visualid() == infos
[i].visualid()) {
175 //i.b.
176 if (recommendedVis.depth() != 30)
177 recommendedIndex = i;
178 }
179 }

after disabling 30 the next depth found by the defaultchooser was 12, which is also not supported.
i should be compared in general to a list of supported visuals for onscreen drawables.

i.b.

If you could iterate on this a bit more and come up with a more general solution I’ll be glad to fold it into the standard distribution.

the problem is to find out the supported depths without special knowlegde of the jvm.
i had a look at the source for 1.4.2 and found the “list” of supported depths in
solaris/classes/sun/awt/X11SurfaceData.java, a switch in the getSurfaceType method with the cases
24, 32, 15, 16 and 8

are there X11-based jvm’s with another set of supported depths?
ok one can iterate up to say 32, calling getSurfaceTyp and catching the sun.java2d.InvalidPipeException

after vacation i will think about it.

i.b.

There might be another approach such as starting from the supported GraphicsConfigurations of the GraphicsDevice (and their associated visual IDs) and trying to use glXChooseVisual to select the best one of those.

the problem of glXChooseVisual is, that you can only specify lower limits of attributs.
to avoid 30 as color depth you have to ask for 32. if you ask for 24 you get 30 as best choice.

for pure glx/opengl this is not a problem, only in case of the restricted capabilities of java’s awt.

i.b.