read_graphic_card_capabilites.adoc 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. = Read Graphic Card Capabilites
  2. :author:
  3. :revnumber:
  4. :revdate: 2016/03/17 20:48
  5. :relfileprefix: ../../
  6. :imagesdir: ../..
  7. ifdef::env-github,env-browser[:outfilesuffix: .adoc]
  8. 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 fetaures the user's hardware supports, and offer a replacement for non-supported features on olde hardware (or deactivate them automatically).
  9. You can read (and print) the capabilities of the user's graphic card using the `com.jme3.renderer.Caps` class:
  10. [source,java]
  11. ----
  12. Collection<Caps> caps = renderer.getCaps();
  13. Logger.getLogger(HelloWorld.class.getName()).log(Level.INFO, “Caps: {0}”, caps.toString());
  14. ----
  15. [NOTE]
  16. ====
  17. Replace `HelloWorld` by the name of the class where you are using this line.
  18. ====
  19. == Examples
  20. A newer graphic card has modern capabilities, for example OpenGL 2.1 and NonPowerOfTwoTextures:
  21. [source]
  22. ----
  23. INFO: Running on jMonkeyEngine 3.0.0
  24. INFO: Using LWJGL 2.8.2
  25. INFO: Selected display mode: 1280 x 720 x 0 @0Hz
  26. INFO: Adapter: null
  27. INFO: Driver Version: null
  28. INFO: Vendor: ATI Technologies Inc.
  29. INFO: OpenGL Version: 2.1 ATI-7.14.5
  30. INFO: Renderer: AMD Radeon HD 6770M OpenGL Engine
  31. INFO: GLSL Ver: 1.20
  32. INFO: Timer resolution: 1.000 ticks per second
  33. INFO: Capabilities: [FrameBuffer, FrameBufferMRT, FrameBufferMultisample,
  34. OpenGL20, OpenGL21, ARBprogram, GLSL100, GLSL110, GLSL120,
  35. VertexTextureFetch, TextureArray, FloatTexture,
  36. FloatColorBuffer, FloatDepthBuffer, PackedFloatTexture, SharedExponentTexture, PackedFloatColorBuffer,
  37. TextureCompressionLATC, NonPowerOfTwoTextures, MeshInstancing]
  38. ----
  39. 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.
  40. [source]
  41. ----
  42. INFO: Running on jMonkey Engine 3
  43. INFO: Using LWJGL 2.7.1
  44. INFO: Selected display mode: 1024 x 768 x 0 @0Hz
  45. INFO: Adapter: null
  46. INFO: Driver Version: null
  47. INFO: Vendor: ATI Technologies Inc.
  48. INFO: OpenGL Version: 2.0 ATI-1.6.36
  49. INFO: Renderer: ATI Radeon X1600 OpenGL Engine
  50. INFO: GLSL Ver: 1.20
  51. INFO: Timer resolution: 1.000 ticks per second
  52. INFO: Capabilities: [FrameBuffer, FrameBufferMRT, FrameBufferMultisample,
  53. OpenGL20, ARBprogram, GLSL100, GLSL110, GLSL120,
  54. VertexTextureFetch, FloatTexture,
  55. TextureCompressionLATC, NonPowerOfTwoTextures]
  56. ----
  57. 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).
  58. [source]
  59. ----
  60. INFO: Capabilities: [FrameBuffer, FrameBufferMRT, FrameBufferMultisample,
  61. OpenGL20, ARBprogram, GLSL100, GLSL110, GLSL120,
  62. VertexTextureFetch, FloatTexture, TextureCompressionLATC]
  63. ----