www.jpct.net

jPCT - a 3d engine for Java => Support => Topic started by: zngga on March 13, 2012, 11:15:31 pm

Title: Testing for OpenGL support
Post by: zngga 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?
Title: Re: Testing for OpenGL support
Post by: zammbi 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
Title: Re: Testing for OpenGL support
Post by: zngga on March 14, 2012, 12:35:11 am
Well, I meant on computers, not Android... but thanks anyway!
Title: Re: Testing for OpenGL support
Post by: zammbi 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).
Title: Re: Testing for OpenGL support
Post by: EgonOlsen 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/ (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.
Title: Re: Testing for OpenGL support
Post by: zngga 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.