title: Programmatically check OpenGL support
body: <p>My swing application is trying to use OpenGL to get better performance. But on some machines the UI doesnt load at all. How could i determine programmatically if OpenGl is supported so i could switch between xrenderer/OpenGL?</p>
  <p>xrenderer works fine on all machines ive tested but id rather use OpenGL</p>
  <p>This is what im using to enabled OpenGL</p>
  <pre><code>System.setProperty(&quot;sun.java2d.opengl&quot;,&quot;True&quot;);
  </code></pre>
  <p>This is what i get on the console:
  &quot;OpenGL pipeline enabled for default config on screen 1&quot;. I think this means that OpenGL is on, but the UI components wont load and the screen is white. I can still click on the invisible buttoms though.
  <a href="https://i.stack.imgur.com/M77wS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/M77wS.png" alt="blankApp" /></a><br />
  <sub>(source: <a href="https://i.ibb.co/hm2JfvM/blankApp.png" rel="nofollow noreferrer">i.ibb.co</a>)</sub></p>
  <p>EDIT: Sort of figured out the problem, OpenGL is enabled on screen 1 but not on screen 0. I dont know how to force it to be enabled on both 0 and 1. Disconnecting the second display caused OpenGL to bve enabled on screen 0, but this did not help and the app is still blank</p>