Checking Capabilities of end-user's machine

Started by
4 comments, last by bubu LV 14 years, 1 month ago
I'm running through the capabilities of the end-users machine, most importantly the OpenGL version and GLSL version. I did some searching on the forums but I couldn't find my answer so I guess a new topic won't hurt (and might help others in my position) Okay so I'm getting the Version of GL and the GLSL Version via glGetString() and GL_VERSION, GL_SHADING_LANGUAGE_VERSION. Now I use atof() to grab the decimal version of OpenGL and store it in a variable known as OpenGLVersion (on my machine, I have OpenGL 2.1.2, so OpenGLVersion is set to 2.1) Now I know for my graphic card, which is an add-on AGP 8x nVidia GeForce 6200A that I have GLSL 1.20 nVidia CG, but what if someone who loads up the game does not have GLSL support? What will GL_SHADING_LANGUAGE_VERSION return? I'd at first assumed it'd return no floating-point number version... but I'm not sure and I don't want to cause problems during load-time, nor do I have a machine that I have access to that does not have hardware support for at least GLSL 1.20 or GL version 2.1 So to define the question, what will GLSL's version return be if the hardware does not support GLSL? Also, if the hardware has an OpenGL version lower than GLSL supports, do I not check for GLSL support?
~With great graphics performance comes great responsibility, just that most programmers don't give a shit about older hardware.
Advertisement
You can try your code in a virtual machine. Download Virtual Box or VMWare Player and grab an iso of Windows (you can have demo version too). So you can try on Windows and Linux easily.
- Iliak -
[ ArcEngine: An open source .Net gaming framework ]
[ Dungeon Eye: An open source remake of Eye of the Beholder II ]
A Virtual machine is not the answer I'm looking for, I need to know this information as soon as a player boots up the game.

Another question is, how can I check if the stencil buffer is supported on the hardware exactly? (or at least the implementation of OpenGL being used) glEnable() only returns an error if the data we pass it isn't a GL cap, or of it was executed between glBegin() and glEnd(). Will it work if I do the following:
bool StencilBuffer = false;glEnable(GL_STENCIL_TEST);if (glIsEnabled(GL_STENCIL_TEST))StencilBuffer = true;


Because I'd assume that if the Stencil buffer isn't supported, then enabling it will fail, so glIsEnabled() wouldn't return true, well I'm assuming at least.
~With great graphics performance comes great responsibility, just that most programmers don't give a shit about older hardware.
See the following page: glGetString. Under notes there is the following information:
Quote:The client and server may support different versions or extensions.

glGetString always returns a compatible version number or list of extensions. The release number always describes the server.

GL_SHADING_LANGUAGE_VERSION is available only if the GL version is 2.0 or greater.


So you would first get the version, and then see if it's larger than 2.0, and then check the shading language version. You can also check the extensions string for many features, for example GL_ARB_vertex_shader.

To check for a stencil buffer, I think that's platform specific, and covered in the setup of OpenGL. For example on Windows it depends on the pixel format you choose, and can be checked from there. Stencil testing without a stencil buffer will just fail silently.. the documentation for glStencilFunc has the following notes:
Quote:If there is no stencil buffer, no stencil modification can occur and it is as if the stencil test always passes.
Quote:So you would first get the version, and then see if it's larger than 2.0, and then check the shading language version. You can also check the extensions string for many features, for example GL_ARB_vertex_shader.

Ah yes I already have added that into my CheckCaps() function ;) I previously knew about the method of checking for extensions but thanks anyway :)

Quote:To check for a stencil buffer, I think that's platform specific, and covered in the setup of OpenGL. For example on Windows it depends on the pixel format you choose, and can be checked from there. Stencil testing without a stencil buffer will just fail silently...

(Note I'm speaking as if I am only supporting a Windows version of my game application) So I create need to check for a pixel format that has all the existing pixel format data I've specified AND for a stencil buffer? I'd assume I'll use DescribePixelFormat() for that, just iterate through the pixel formats until either I find one that fits what I want, or until it's gone through them all and found none that support a Stencil buffer, then I just check to see if I can use a pixel format that has no Stencil Buffer correct?
~With great graphics performance comes great responsibility, just that most programmers don't give a shit about older hardware.
You could try getting number of bits per pixel in stencil buffer:
glGetIntegerv(GL_STENCIL_BITS, &value);

If it is 0, then you have no stencil buffer.

This topic is closed to new replies.

Advertisement