Skip to main content
gamedev.net
🔒 Locked

getShaderVersion() ???

Started by bebud Sep 21, 2005 at 8:27 AM 6 replies 1.4k views
Original Post
bebud
bebud
Hey! This might be a simple one but I cannot find any info about it: I wonder if there is a similar function in OpenGL like VertexShaderVersion() in DX? Greets, Bebud :)
mrbastard
mrbastard
check the extension strings
[size="1"]
bebud
bebud
hmmm...but there is no string like GL_ARB_fragment_program_2 or GL_ARB_fragment_program_3 or whatever shader version, or?
I don't want to know if shaders are available. I want to know which version is available.
smitty1276
smitty1276
In Cg there is a function called something like cgGLGetNewestProfile(CG_VERTEX_PROG) or something like that.

bebud
bebud
Quote:
Original post by smitty1276
In Cg there is a function called something like cgGLGetNewestProfile(CG_VERTEX_PROG) or something like that.


thanks :)
and what should I use in GLSL?
RichardS
RichardS
There are no such versions. If the GLSL extensions string is exported, you can use GLSL. Just be sure to check the HW limits using the functions provided in ARB_vertex_shader and ARB_fragment_shader.
bebud
bebud
Quote:
Original post by RichardS
There are no such versions. If the GLSL extensions string is exported, you can use GLSL. Just be sure to check the HW limits using the functions provided in ARB_vertex_shader and ARB_fragment_shader.


ok. thanks :)
what do you mean by checking the functions? You mean I should check if the shader compiles and links?

The problem is that I have shaders which should use dynamic branching and loops if the HW supports them. Otherwise It should use "light-versions" of the shaders. But the decision should be made in the c++ program.
Maybe there is a workaround for this?
rollo
rollo
You can call glGetString(GL_SHADING_LANGUAGE_VERSION_ARB) but it's not very useful for what you wanted (figuring out capabilities). its not a standardised format. Mine looks like this: "1.10 NVIDIA via Cg 1.3 compiler".

Cant you just make some small shader programs that test the capabilities. for example, texture reads from vertex shader, dynamic branching in fragment shader etc and see if it compiles? Compiling a small program like that should be fairly quick.

Edit: by "not standardized format" I meant that there was more than a number there, I havent checked the glsl spec on this so it is possible that all version strings must have the actual number first... anyway it wont help with what you were after.

you can also query some language features. GL_MAX_VERTEX_ATTRIBS_ARB, GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB etc. google for the rest

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.