How to detect no 3d hardware available

Hey guys,

I’m using Xith3D with Swing. The owner of the canvas is JPanel. If there is no hardware acceleration available, I want to show “Not hardware acceleration available” on the JPanel and the program should continue to work with Xith3D disabled.

When should it throw an exception if there is no hardware acceleration available?

Thanks

Xith also works without hardware accelaration. You could simply make a checkbox, where the user can turn off your xith-canvas, no hardware accelaration might not always mean, that the scene doesn’t get rendered well enough.

I tried it on a Dell box with an intergrated Intel graphics card which doesn’t support OpenGL (at least the driver installed by Dell). When I run it, it throws an exception. This is no problem because I can handle because I can catch the exception.

On my box which has a GeForce FX 5200, it also throws an exception when I disable “hardware acceleration” in the display options of Win2k. This one is problematic because I can’t catch it. Somewhere down in the path, someone calls System.exit(0).

Both exception seems to be thrown when I call renderOnce() on a View.

How can I handle this?

Exception thrown when disabling "hardware acceleration


net.java.games.jogl.GLException: Method "glActiveTextureARB" not available
	at net.java.games.jogl.impl.windows.WindowsGLImpl.glActiveTextureARB(WindowsGLImpl.java:94)
	at com.xith3d.render.jogl.TextureShaderPeer.shade(TextureShaderPeer.java:616)
	at com.xith3d.render.CanvasPeerBase.setState(CanvasPeerBase.java:121)
	at com.xith3d.render.CanvasPeerBase.render(CanvasPeerBase.java:99)
	at com.xith3d.render.jogl.CanvasPeerImpl.drawBin(CanvasPeerImpl.java:759)
	at com.xith3d.render.jogl.CanvasPeerImpl.display(CanvasPeerImpl.java:1003)
	at net.java.games.jogl.impl.GLDrawableHelper.display(GLDrawableHelper.java:74)
	at net.java.games.jogl.GLCanvas$DisplayAction.run(GLCanvas.java:249)
	at net.java.games.jogl.impl.GLContext.invokeGL(GLContext.java:292)
	at net.java.games.jogl.impl.windows.WindowsOnscreenGLContext.invokeGL(WindowsOnscreenGLContext.java:79)
	at net.java.games.jogl.GLCanvas$DisplayOnEventDispatchThreadAction.run(GLCanvas.java:266)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:171)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:454)
	at vista.simulation.util.CustomAWTEventQueue.dispatchEvent(CustomAWTEventQueue.java:116)
	at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)

Exception thrown when running on the integrated Intel graphics card


Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
        at net.java.games.jogl.impl.windows.WindowsGLContextFactory.getDummyGL(WindowsGLContextFactory.java:168)
        at net.java.games.jogl.impl.windows.WindowsGLContext.choosePixelFormatAndCreateContext(WindowsGLContext.java:288)
        at net.java.games.jogl.impl.windows.WindowsOnscreenGLContext.create(WindowsOnscreenGLContext.java:230)
        at net.java.games.jogl.impl.windows.WindowsGLContext.makeCurrent(WindowsGLContext.java:136)
        at net.java.games.jogl.impl.windows.WindowsOnscreenGLContext.makeCurrent(WindowsOnscreenGLContext.java:129)
        at net.java.games.jogl.impl.GLContext.invokeGL(GLContext.java:246)
        at net.java.games.jogl.impl.windows.WindowsOnscreenGLContext.invokeGL(WindowsOnscreenGLContext.java:76)
        at net.java.games.jogl.GLCanvas$2.run(GLCanvas.java:130)
        at java.awt.event.InvocationEvent.dispatch(Unknown Source)
        at java.awt.EventQueue.dispatchEvent(Unknown Source)
        at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.run(Unknown Source)
Exception in thread "Thread-4" net.java.games.jogl.GLException: java.lang.reflect.InvocationTargetException
        at net.java.games.jogl.GLCanvas.maybeDoSingleThreadedWorkaround(GLCanvas.java:233)
        at net.java.games.jogl.GLCanvas.display(GLCanvas.java:77)
        at com.xith3d.render.jogl.CanvasPeerImpl.render(CanvasPeerImpl.java:1136)
        at com.xith3d.scenegraph.View.renderOnce(View.java:604)
        at com.xith3d.scenegraph.View.renderOnce(View.java:537)
        at generic3d.xith3d.view.SceneModelPanel$RenderingThread.run(Unknown Source)
Caused by: java.lang.reflect.InvocationTargetException
        at java.awt.EventQueue.invokeAndWait(Unknown Source)
        at net.java.games.jogl.GLCanvas.maybeDoSingleThreadedWorkaround(GLCanvas.java:228)
        ... 5 more
Caused by: java.lang.NullPointerException
        at net.java.games.jogl.impl.windows.WindowsGLContextFactory.getDummyGL(WindowsGLContextFactory.java:168)
        at net.java.games.jogl.impl.windows.WindowsGLContext.choosePixelFormatAndCreateContext(WindowsGLContext.java:288)
        at net.java.games.jogl.impl.windows.WindowsOnscreenGLContext.create(WindowsOnscreenGLContext.java:230)
        at net.java.games.jogl.impl.windows.WindowsGLContext.makeCurrent(WindowsGLContext.java:136)
        at net.java.games.jogl.impl.windows.WindowsOnscreenGLContext.makeCurrent(WindowsOnscreenGLContext.java:129)
        at net.java.games.jogl.impl.GLContext.invokeGL(GLContext.java:246)
        at net.java.games.jogl.impl.windows.WindowsOnscreenGLContext.invokeGL(WindowsOnscreenGLContext.java:76)
        at net.java.games.jogl.GLCanvas$DisplayOnEventDispatchThreadAction.run(GLCanvas.java:266)
        at java.awt.event.InvocationEvent.dispatch(Unknown Source)
        at java.awt.EventQueue.dispatchEvent(Unknown Source)
        at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.run(Unknown Source)

Here a some more info when I disable the “hardware acceleration”.

Init GL is net.java.games.jogl.impl.windows.WindowsGLImpl
OpenGL Renderer = GDI Generic
OpenGL Version = 1.1.0
OpenGL Vendor = Microsoft Corporation
OpenGL Extensions = GL_WIN_swap_hint GL_EXT_bgra GL_EXT_paletted_texture

Xith3D always take for granted that your hardware support OpenGL with a few extensions.

In particular, multitexturing with 4 texture units is needed which is not supported on default OpenGL driver under Windows NT for example.

To solve this, you can use Mesa OpenGL.

           Vincent

Thanks a lot for replies guys.

Is there a way at runtime to detect if the hardware is compatible with Xith3D? Would it be a fair assumption to ask JOGL for the OpenGL version supported by the driver and if it’s < 1.2 take into account that it’s not supported?

From the Xith3D FAQ:

Thanks

Are the options found in com.xith3d.render.jogl.OpenGlExtensions the extensions that the driver must support to be able to work with Xith3D?

If I detect that one of those booleans is false, is it a good assumption that it’s not compatible with Xith3D?


public class OpenGlExtensions {
    public static boolean ARB_vertex_buffer_object = false;
    public static boolean GL_ARB_vertex_program = false;
    public static boolean GL_ARB_fragment_program = false;
    public static boolean GL_ARB_texture_cube_map = false;
    public static boolean GL_EXT_texture_filter_anisotropic = false;
    public static boolean GL_EXT_separate_specular_color = false;
    public static boolean GL_EXT_texture_cube_map = false;
    public static boolean GL_ARB_transpose_matrix = false;
    public static boolean GL_NV_texgen_reflection = false;
    public static boolean GL_KTX_buffer_region = false;

    ...

Actually I think you need OpenGL 1.3 or better now.

The crappy Microsoft one won’t work for much at all (not just Xith3D).

ATI or nVidia are your best bets. Even their really old and crap cards still get driver updates and still work with Xith3D.

Will.