Jump to content
  • Advertisement
Sign in to follow this  
rapunzel

OpenGL find out about shader version when my program starts up

This topic is 4466 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, does anyone know how to do the following? When my program starts up and is about to install the shaders, I want to check, wich shader version and capabilities (e.g. no. of instructions) the graphics card supports, to then decide which shader to load or to avoid installing shaders. Does even OpenGL support something likely? I mean modern games seem to do such a thing, don't they? greetz rapunzel

Share this post


Link to post
Share on other sites
Advertisement
For GLSL use glGetString(GL_SHADING_LANGUAGE_VERSION), may need to append that with _ARB, depending on the headers. Then you have to parse version number. The version itself doesn't say that much, basic system with opengl is to query the extensions and decide from there, even knowing the card-model which you can get too doesn't say anything.

You can always try to compile the shader and if it fails, don't use it! That's the simplest mechanism.

Then theres the "half" number support with nVidia and only proper way to handle that is in the shader with preprocessor defines.

ch.

Share this post


Link to post
Share on other sites
Hi,

thanks so far. But checking for GL_SHADING_LANGUAGE_VERSION gives me the version of the GLSL, what I wanted is to know wich shader model the card supports (sorry I was unclear about that i my first post :-/). Because my main shader works properly only on SM 3.0 cards. Therefore I wrote another shader that works on 2.0 cards too (less instructions, no loops) and I want to dynamicaly decide now, which one to load or better load no shader at all ...

greetz
rapunzel

Share this post


Link to post
Share on other sites
Yeah it's true, the shader model is D3D specific. The problem is, that's kinda good general measure what capabilities the card has. The problem is that my shader program doesn't run on older cards, cards that could be sumarized as SM 2.0 cards. for them I want to load a different, simpler shader, I just struggle to figure out how to detect if a card is able to run the complex shader and when to use the simpler one. How do you people here do that?

greetz
rapunzel

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!