Read Graphic Card Capabilities

When different people test your new game, you may get feedback that the game doesn’t run on their hardware, or that some details don’t look as expected. You need to detect which features the user’s hardware supports, and offer a replacement for non-supported features on older hardware (or deactivate them automatically).

You can read (and print) the capabilities of the user’s graphic card using the com.jme3.renderer.Caps class:

Collection<Caps> caps = renderer.getCaps();
Logger.getLogger(HelloWorld.class.getName()).log(Level.INFO, "Caps: {0}", caps.toString());

Replace HelloWorld by the name of the class where you are using this line.

Examples

A newer graphic card has modern capabilities, for example OpenGL 2.1 and NonPowerOfTwoTextures:

INFO: Running on jMonkeyEngine 3.0.0
INFO: Using LWJGL 2.8.2
INFO: Selected display mode: 1280 x 720 x 0 @0Hz
INFO: Adapter: null
INFO: Driver Version: null
INFO: Vendor: ATI Technologies Inc.
INFO: OpenGL Version: 2.1 ATI-7.14.5
INFO: Renderer: AMD Radeon HD 6770M OpenGL Engine
INFO: GLSL Ver: 1.20
INFO: Timer resolution: 1.000 ticks per second
INFO: Capabilities: [FrameBuffer, FrameBufferMRT, FrameBufferMultisample,
OpenGL20, OpenGL21, ARBprogram, GLSL100, GLSL110, GLSL120,
VertexTextureFetch, TextureArray, FloatTexture,
FloatColorBuffer, FloatDepthBuffer, PackedFloatTexture, SharedExponentTexture, PackedFloatColorBuffer,
TextureCompressionLATC, NonPowerOfTwoTextures, MeshInstancing]

Here is an example of the capabilities of an semi-old graphic card that only supports OpenGL 2.0. If you use OpenGL 2.1 features you need to decide whether to branch to a low-quality replacement of the unsupported features (if you still want to support this card); or whether the game will not start at all and displays an error message explaining the user what capabilities his hardware is missing to be able to play the game.

INFO: Running on jMonkey Engine 3
INFO: Using LWJGL 2.7.1
INFO: Selected display mode: 1024 x 768 x 0 @0Hz
INFO: Adapter: null
INFO: Driver Version: null
INFO: Vendor: ATI Technologies Inc.
INFO: OpenGL Version: 2.0 ATI-1.6.36
INFO: Renderer: ATI Radeon X1600 OpenGL Engine
INFO: GLSL Ver: 1.20
INFO: Timer resolution: 1.000 ticks per second
INFO: Capabilities: [FrameBuffer, FrameBufferMRT, FrameBufferMultisample,
OpenGL20, ARBprogram, GLSL100, GLSL110, GLSL120,
VertexTextureFetch, FloatTexture,
TextureCompressionLATC, NonPowerOfTwoTextures]

This next example is lacking NonPowerOfTwoTextures, this tells you that this user’s graphic card cannot handle textures with sizes that are not square powers of two (such as “128x128”).

INFO: Capabilities: [FrameBuffer, FrameBufferMRT, FrameBufferMultisample,
OpenGL20, ARBprogram, GLSL100, GLSL110, GLSL120,
VertexTextureFetch, FloatTexture, TextureCompressionLATC]