PDA

View Full Version : shaders and extensions



guyinhell
01-25-2005, 05:46 AM
i think i am always asking stupid questions. but sometimes really cannot get any clues.
how can i use the shading language? do i need to include any header files?
for extensions:
from the spec, we can see the name and the name strings of a certain extension, but how to use it? is it the same as other OpenGL functions? and what are the programs? how to use them? i read many materials already, still cannot understand it.

Relic
01-25-2005, 06:38 AM
You need an OpenGL implementation supporting GL_ARB_shader_objects, GL_ARB_vertex_shader and GL_ARB_fragment_shader. (Forget about the useless GL_ARB_shading_language_100 string.)

Then get the entry points of those extensions via wglGetProcAddress like for any other function above OpenGL 1.1 (Microsoft's OpenGL32.dll's fault), mainly the GL_ARB_shader_objects ones and use them to load your shader source, compile and attach the shaders, link and use the program.
Set your uniforms and render your geometry.

GLSL tutorials and running examples with a glext.h which contains the extension's function prototypes and GLenums are very easy to find on the internet.

dorbie
01-25-2005, 12:14 PM
You also need to include glext.h, it's probably best to use the one from and SDK from your cards designer (NVIDIA ATI etc.

You can also look into using something like the extension wrangler library GLEW. http://glew.sourceforge.net/

guyinhell
01-26-2005, 09:28 PM
hi:
thanx for your information. at the moment i dont have a graphics card which supports shading language. will try it later:)