Sign in to follow this  

GLEW, what to check when using GLSL?

This topic is 4272 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

Using GLEW, I want to check if GLSL (2.0) is supported. For example, if checking for ARB_vertex_program's this is done (from the GLEW website): if (GLEW_ARB_vertex_program) { /* It is safe to use the ARB_vertex_program extension here. */ glGenProgramsARB(...); } What do I need here???: if (GLEW_???????) { program = glCreateProgramObjectARB(); unsigned int vertex_object = glCreateShaderObjectARB(GL_VERTEX_SHADER_ARB); glShaderSourceARB(vertex_object, 1, (const char**) &vertex_data, NULL); glCompileShaderARB(vertex_object); glAttachObjectARB(program, vertex_object); glDeleteObjectARB(vertex_object); ... and so on... ... } else { glAlert("Sorry, no shaders!"); } Thanks all in advance!!!

Share this post


Link to post
Share on other sites
Checking for GLEW_VERSION_2_0 will let you know if the video card supports OpenGL 2.0. Since GLSL was added in GL 2.0, you should be able to use that functionality.

Share this post


Link to post
Share on other sites
What you're using there is the ARB_shader_objects extension. So most probably GLEW has something like if (GLEW_ARB_shader_objects) // do stuff; but I can't of course be sure, so try it out.

Edit--
Dorvo: He isn't actually using the core GL 2.0 functions, those would be glCreateShader, glDeleteShader etc without the trailing ARB

Share this post


Link to post
Share on other sites
True; but, he did want to check if 2.0 was supported. Is there really any difference between the core functions and the ARB versions?

Share this post


Link to post
Share on other sites
Quote:
Original post by Dorvo
True; but, he did want to check if 2.0 was supported. Is there really any difference between the core functions and the ARB versions?

Not really but there is a difference in the object model: in the ARB extension everything was an 'object' but in the 2.0 API shaders and program objects have been separated completely. eg. earlier you would use glGetInfoLogARB to get both the link and compile logs, but now we use glGetProgramInfoLog for the linker log and glGetShaderInfoLog for the compile log.

I prefer (and would also suggest if asked) the 2.0 core functions, if your hardware (as well as the hardware you are targetting) has 2.0 drivers.

Share this post


Link to post
Share on other sites
While deavik's got the right idea, nVidia tells people if you can't find the extension in the list, it wont be hardware accelerated. This seems to hold true, since my GeForce 2 supports Open GL 1.5, but it doesn't use hardware acceleration for things like 3D textures, which are in the 1.3 core.

Share this post


Link to post
Share on other sites

This topic is 4272 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this