Author Topic: Testing for OpenGL support  (Read 1234 times)

Offline zngga

  • byte
  • *
  • Posts: 6
    • View Profile
Testing for OpenGL support
« on: March 13, 2012, 11:15:31 pm »
Is there a way to test a system for OpenGL, that way you can set software mode if the system doesn't have GL drives installed?

Offline zammbi

  • float
  • ****
  • Posts: 360
    • View Profile
Re: Testing for OpenGL support
« Reply #1 on: March 13, 2012, 11:35:11 pm »
All android devices supports OpenGL 1.0.

To check if its using software mode I use:

Code: [Select]
String renderer = gl.glGetString(GL10.GL_RENDERER); //Check for software renderer.
boolean isSoftwareRenderer = renderer.contains("PixelFlinger");

You could use "GL10.GL_VERSION" instead to get the supported version back as a string. If you want to check if it supports 2.0.

Edit here is the link where I stole that from:
http://android-developers.blogspot.co.nz/2010/06/game-development-for-android-quick.html
« Last Edit: March 14, 2012, 12:04:01 am by zammbi »

Offline zngga

  • byte
  • *
  • Posts: 6
    • View Profile
Re: Testing for OpenGL support
« Reply #2 on: March 14, 2012, 12:35:11 am »
Well, I meant on computers, not Android... but thanks anyway!

Offline zammbi

  • float
  • ****
  • Posts: 360
    • View Profile
Re: Testing for OpenGL support
« Reply #3 on: March 14, 2012, 01:56:03 am »
Woops haha. I forgot that this topic was on the desktop jpct.
There is probably some way to do such things on the desktop. Otherwise you could catch the exception if OpenGL fails and then do software stuff instead (to simulate this could simplify uninstall your graphics drivers).

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11747
    • View Profile
    • http://www.jpct.net
Re: Testing for OpenGL support
« Reply #4 on: March 14, 2012, 09:09:19 am »
It basically boils down to what zammbi said: Try to initialize it and catch the exception. You might want to do this outside of jPCT by creating a small LWJGL window (Display.create(...)...) to see if that works. You might want to look at the starter class (forgot the name...) in the Robombs sources (http://jpct.de/robombs.game/download/). I'm opening a splash screen to hide the actual OpenGL window, try to open the gl window, query some settings and then close it again. Maybe that helps.

Offline zngga

  • byte
  • *
  • Posts: 6
    • View Profile
Re: Testing for OpenGL support
« Reply #5 on: March 14, 2012, 09:50:44 pm »
Ok, thanks, that was how I was gona do it, but thought I'd ask if there was an actual class and/or method that was designed for this.