Shaders and Tools

I have been into OGL for a while, but I wasn’t around when the shaders and vertex programmer stuff started coming around so I am trying to come up to speed with this stuff.

I’ve been looking around for a shader tool for OGL. I have seen NVidia’s Cg, which only runs on Windows, and OpenGL shader, which only runs on Unix.

I need a shader library that will run on both Windows and Linux. I am assuming I will have to write it myself.

Are there any docs on the web that talk about how to do shader programming on OGL (not D3D! I can find that crap). I have not been able to find a good OGL doc yet anywhere.

Also are there any likewise docs that talk about vertex programming with OGL? Something that will get me up to speed quick so I can see what it’s all about.

I appreciate your time.

Umm, I don’t know what your talking about. I have Cg installed on my Linux box.

$ cgc --help
cgc: bad argument: “–help”
usage: cgc [-quiet] [-nocode] [-nostdlib] [-longprogs] [-v] [-Dmacro[=value]]
[-profile id] [-entry id] [-o ofile] [file.cg]
supported profiles:
“fp30”
“arbvp1”
“dx8vs”
“vp20”
“vp30”
“dx8ps”
“generic”

Oh sorry, I was under the impression Cg was only for Windows.

This is good news than. Thanks.

http://oss.sgi.com/projects/ogl-sample/registry/ARB/vertex_program.txt

Read the whole thing.

Did somebody notice that programming shaders using OpenGL became total disaster since ATI and NVIDIA implemented pixel shaders through different extensions…

If you want your cool effect working somewhere besides GeForce, forget about Cg and read this document:
http://mirror.ati.com/developer/ATIHardwareShading.pdf

Or even better go to http://mirror.ati.com/developer/techpapers.html

And they not even feel sorry for that…

Originally posted by justuss:
[b]Did somebody notice that programming shaders using OpenGL became total disaster since ATI and NVIDIA implemented pixel shaders through different extensions…

If you want your cool effect working somewhere besides GeForce, forget about Cg and read this document:
http://mirror.ati.com/developer/ATIHardwareShading.pdf

Or even better go to http://mirror.ati.com/developer/techpapers.html

And they not even feel sorry for that…[/b]

hm? ati implements pixel shaders trough GL_ARB_fragment_shaders, the official “pixelshaders” of gl… so what?

and don’t start talking about pre radeon9700… the 8500, gf4,gf3 don’t have pixelshaders, they have some primitive texturesampling setup… thats all.

Neither Radeon 9000, 8500, nor GF4 has an extension you named…

Radeon has ATI_FRAGMENT_SHADER
Here are my GF4’s extensions:
GL_ARB_depth_texture
GL_ARB_imaging
GL_ARB_multisample
GL_ARB_multitexture
GL_ARB_shadow
GL_ARB_texture_border_clamp
GL_ARB_texture_compression
GL_ARB_texture_cube_map
GL_ARB_texture_env_add
GL_ARB_texture_env_combine
GL_ARB_texture_env_dot3
GL_ARB_transpose_matrix
GL_S3_s3tc
GL_EXT_abgr
GL_EXT_bgra
GL_EXT_blend_color
GL_EXT_blend_minmax
GL_EXT_blend_subtract
GL_EXT_compiled_vertex_array
GL_EXT_draw_range_elements
GL_EXT_fog_coord
GL_EXT_multi_draw_arrays
GL_EXT_packed_pixels
GL_EXT_paletted_texture
GL_EXT_point_parameters
GL_EXT_rescale_normal
GL_EXT_secondary_color
GL_EXT_separate_specular_color
GL_EXT_shadow_funcs
GL_EXT_shared_texture_palette
GL_EXT_stencil_wrap
GL_EXT_texture3D
GL_EXT_texture_compression_s3tc
GL_EXT_texture_edge_clamp
GL_EXT_texture_env_add
GL_EXT_texture_env_combine
GL_EXT_texture_env_dot3
GL_EXT_texture_cube_map
GL_EXT_texture_filter_anisotropic
GL_EXT_texture_lod
GL_EXT_texture_lod_bias
GL_EXT_texture_object
GL_EXT_vertex_array
GL_EXT_vertex_weighting
GL_HP_occlusion_test
GL_IBM_texture_mirrored_repeat
GL_KTX_buffer_region
GL_NV_blend_square
GL_NV_copy_depth_to_color
GL_NV_evaluators
GL_NV_fence
GL_NV_fog_distance
GL_NV_light_max_exponent
GL_NV_multisample_filter_hint
GL_NV_occlusion_query
GL_NV_packed_depth_stencil
GL_NV_point_sprite
GL_NV_register_combiners
GL_NV_register_combiners2
GL_NV_texgen_reflection
GL_NV_texture_compression_vtc
GL_NV_texture_env_combine4
GL_NV_texture_rectangle
GL_NV_texture_shader
GL_NV_texture_shader2
GL_NV_texture_shader3
GL_NV_vertex_array_range
GL_NV_vertex_array_range2
GL_NV_vertex_program
GL_NV_vertex_program1_1
GL_SGIS_generate_mipmap
GL_SGIS_multitexture
GL_SGIS_texture_lod
GL_SGIX_depth_texture
GL_SGIX_shadow
GL_WIN_swap_hint
WGL_EXT_swap_control

Please point me to ATI_fragment_shader extension here, or ARB_fragment_shader, as you name it (as I remember. it is NOT approved by ARB)…

I continue…
So, what are
GL_NV_register_combiners
GL_NV_register_combiners2
?

As I know, Cg compiles pixel shader code to this extensions calls…
Or what???

ARB_fragment_program was approved at the last ARB meeting. You can find the extension specification here:
http://oss.sgi.com/projects/ogl-sample/registry/ARB/fragment_program.txt

I’m not aware of any drivers that support it yet, but hopefully this (along with ARB_vertex_program) will clean up shader programming in OpenGL considerably in the near future.

– Ben

And Radeon 8500 and 9000 has ATI_fragment_shader…

Now I see, http://oss.sgi.com/projects/ogl-sample/registry/ARB/fragment_program.txt

Will probably solve the problem. But I am talking about nowadays…

and don’t start talking about pre radeon9700… the 8500, gf4,gf3 don’t have pixelshaders, they have some primitive texturesampling setup… thats all.

Don’t lump the 8500 in there. It has pretty useful and powerful per-fragment operations. Unlike the “primitive texturesampling setup”, you can do arbiturary computations (to the limit of the number of instructions) and use the results in a texture lookup. The GeForce3/4 were pretty weak; the 8500 was not.

Originally posted by Korval:
Don’t lump the 8500 in there. It has pretty useful and powerful per-fragment operations. Unlike the “primitive texturesampling setup”, you can do arbiturary computations (to the limit of the number of instructions) and use the results in a texture lookup. The GeForce3/4 were pretty weak; the 8500 was not.

yeah, okay… while primitive, it is shading… and quite awesome looking (running the demos on my 9700 )

oh, and i ment GL_ARB_fragment_program, not fragment_shader actually… sorry