View Full Version : Fragment program definition

04-17-2004, 07:14 AM
Hi, could someone tell me what is a fragment program, what is used specifically for, and what cards support it ?

04-17-2004, 07:32 AM
Fragment programs are small assembly-like programs that you can use instead of the fixed OpenGL pipeline.They are executed for every pixel of the screen(every fragment,to be precise).
This way,you can write your own fragment programs to achive complex effects.For example,OpenGL computes the lighting per-vertex and then interpolates the results(gouraud shading).With fragment programs,you can perform the same computations for every pixel(per-pixel lighting).
Look at the spec for ARB_fragment_program
extension for more informations.
Also,recently there is support for a higher level C-like language,the GL Shading Language(GLSL).
Read the specs for ARB_fragment_shader,ARB_vertex_shader,ARB_shader_o bjects for more info of how to build GLSL programs within you app and download the spec of the GLSL itself.
You can find all this and many examples in

04-17-2004, 12:39 PM
Thanks, i will seek for the arb spec. I really hope to find some simple info or example code about fragments. What i really find "strange" is that there are tons of technical papers which don't tell much, while, in my opinion, few good tutorials or code examples would be more useful and instructive. I googled all day looking for fragment example programs, the few i found are about 500k and contain about 12 c++ files, it will take weeks to understand how they work. For newbies, like me, since the arrive of cg, GLSL, vertex and pixel shaders, opengl became much harder ... :rolleyes: