Testing for OpenGL support

Started by zngga, March 13, 2012, 11:15:31 PM

Previous topic - Next topic

zngga

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?

zammbi

#1
All android devices supports OpenGL 1.0.

To check if its using software mode I use:

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

zngga

Well, I meant on computers, not Android... but thanks anyway!

zammbi

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).

EgonOlsen

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.

zngga

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.