PDA

View Full Version : Test for support for glCreateShader ?



Mctittles
08-21-2011, 11:10 PM
I've wrote a small program and have been testing it on older machines to see where it breaks to try to increase the compatibility.
Currently I'm running into a problem with a Geforce 3 card and glCreateShader. If I check for GL_ARB_shading_language_100 it comes back ok, however calling glCreateShader crashes the program.
I know the card only has limited shader support, however what is the best way to check for this support? All examples I have found only check for GL_ARB_shading_language_100 and then set all the extentions for shaders, however this is not enough as even though GL_ARB_shading_language_100 comes back, glCreateShader will just crash.

Alfonse Reinheart
08-22-2011, 12:44 AM
You should be using an extension loading library (http://www.opengl.org/wiki/Extension_Loading_Library).

Also, glCreateShader is not an extension function. It is a core function in OpenGL version 2.0 and above. So check the version number if you want that particular function.

Furthermore, GL_ARB_shading_language_100 means very little. All it means is that the implementation supports GLSL version 1.00. It says nothing about how to use it.

In general, you should first check for GL version 2.0 and above. If that is available, then you can use the regular core shader API. If it is not, then you should check for ARB_shader_objects. That is the extension that has the shader and program functions in it, which are different from the GL 2.0 core functionality. The core shader objects are GLuint's; the extension-based shader objects are GLhandleARB's.

ARB_shader_objects (http://www.opengl.org/registry/specs/ARB/shader_objects.txt) defines glCreateShaderARB and similar functions. But that only defines the API; it doesn't define any of the shader stages. The shader stages are defined by the extensions ARB_vertex_shader (http://www.opengl.org/registry/specs/ARB/vertex_shader.txt) and ARB_fragment_shader (http://www.opengl.org/registry/specs/ARB/fragment_shader.txt). It is possible for a driver to only expose one of these stages. For example, your GeForce 3 card can't even begin to handle ARB_fragment_shader, so if you get shader objects at all, it will only be ARB_vertex_shader.

Note that 2.0 and above (which your GeForce 3 card doesn't support) doesn't care about any of the above. All GL 2.0 and above implementations will have both vertex and fragment shaders available.

V-man
08-22-2011, 06:20 AM
Geforce 3 should support GL 1.5
If they added ARB_shader_objects and such, I would be surprised. Perhaps it supports ARB_vertex_shader but it would fail for most vertex shaders due to its hw limits.

Suggest that you buy a new computer.

mbentrup
08-22-2011, 07:46 AM
http://feedback.wildfiregames.com/report/opengl/device/GeForce3:

Vertex shaders are supported, but no Fragment shaders (even on GeForce2 MX). They may be emulated in software though.

BionicBytes
08-22-2011, 08:55 AM
I remember my GeForce 4200Ti did not support Fragment shaders but did support Vertex Shaders. That was one of the reasons why I binned the card in the end.

ZbuffeR
08-22-2011, 09:00 AM
Please note that the OP specifically asked for help to "increase the compatibility" of a working program on older machines, no need to suggest to buy new hardware...

Mctittles
08-22-2011, 01:19 PM
@Alfonse Reinheart
Thanks for the information, this is very helpful stuff!

Yea, I know I should be using an extension loading library, but right now I'm learning and would like to see how this all works.

mhagain
08-22-2011, 05:00 PM
I'm wondering if it's worth worrying about compatibility with something as ancient as a GF3 - are there even any of those still in active usage out there in the wild? And if so, would someone who has one be included in the potential target audience for your program? And if so, is it worth the investment of your time and effort to get your program working for someone who might still have one?

Anyway, if you do want to support something that old maybe you should be looking at ARB_vertex_program and ARB_fragment_program instead?

Mctittles
08-22-2011, 06:22 PM
I don't really have a huge test bed of computers here. I have a modern Geforce, a mid range ATI, and a box of old computer parts from years ago. The Geforce 3 was found in the box.
What I'm aiming for is to make sure it works on laptops with integrated graphics that don't have shader support. I figured if I make sure it works on some ancient computer, the chances of it working on a laptop with integrated graphics are better.
I also would rather people booting it up with machines that can't run don't just get an unknown windows crash error, so I'm working on better error reporting as well. This is my first openGL program so it's worth it to me to have a solid base to use in all my future projects.

Alfonse Reinheart
08-22-2011, 06:59 PM
This is my first openGL program so it's worth it to me to have a solid base to use in all my future projects.

Your first OpenGL program should not be trying to target a huge range of hardware with multiple rendering backends.

V-man
08-23-2011, 03:59 AM
I'm wondering if it's worth worrying about compatibility with something as ancient as a GF3 - are there even any of those still in active usage out there in the wild? And if so, would someone who has one be included in the potential target audience for your program? And if so, is it worth the investment of your time and effort to get your program working for someone who might still have one?

Anyway, if you do want to support something that old maybe you should be looking at ARB_vertex_program and ARB_fragment_program instead?

gf3 won't support ARB_fragment_program. Only SM 2.0 and above hw supports it.

For gf3, you need to do NV_register_combiners and NV_texture_shader and NV_register_combiners2 and NV_register_combiners3 and NV_texture_shader2 and NV_texture_shader3.

Or you download that nvidia shader tool (I no longer remember the name) and you write text based shaders.
And all the above is isolated to nvidia.

Or better yet, you just target OpenGL 1.1 and save yourself a lot of headache on all those intel junks. Or, you go with DirectX. No extensions to worry about. It will run more or less fine on intel. Or you tell intel users to bombard intel with emails for technical support.