Question

http://http.developer.nvidia.com/Cg/TessellationControlShader.html

I have some questions regarding CG.

What OpenGL version does CG support? On their site they state

Opengl Functionality Requirements

OpenGL 1.0

Which seems a little bit odd to me. For me this means that I need to have at least OpenGL 1.0 to use all OpenGL features in CG. So litteraly all new OpenGL features are missing?

Also the compute shader seems to be missing

GeometryShader, PixelShader, TessellationEvaluationShader, VertexShader, FragmentProgram, GeometryProgram, TessellationControlProgram, TessellationEvaluationProgram, VertexProgram

Is CG now a viable alternative to replace GLSL 4.x? Can I write all shaders in CG that I could write in GLSL 4.3?

Was it helpful?

Solution 3

I'm pretty sure that OpenGL-1.0 is a typo. DirectX-11 is about the function level you get with OpenGL-4.0. Now look what key is right below the 4 on the numpad.

In fact no single NVidia GPU ever did support only a OpenGL profile as low as OpenGL-1.0. OpenGL-1.0 dates back 20 years.


Is CG now a viable alternative to replace GLSL 4.x?

Well, I personally don't see a reason why to use Cg, except if you want to support both OpenGL and DirectX with a common set of shaders. But why would you want cross API compatibility? If you aim for portability then OpenGL wins clearly over DirectX.

IMHO the main reason to keep using Cg is, if you have to maintain a legacy product that uses Cg already. Remember that Cg was introduced long before OpenGL had a high level shading language.

Can I write all shaders in CG that I could write in GLSL 4.3?

Yes.

OTHER TIPS

Is CG now a viable alternative to replace GLSL 4.x? Can I write all shaders in CG that I could write in GLSL 4.3?

No. While some OpenGL 4.x features, such as tessellation, are exposed as of Cg 3.1, others are not.

Notable missing features in Cg 3.1 (and their OpenGL names) include:

  • compute shaders
  • atomic counters
  • shader-writeable storage blocks (shader storage blocks)
  • shader-writable textures (image load / store)
  • runtime shader function selection (shader subroutines)

In general, Cg tends to lag two or three years behind the latest OpenGL release.

Cg has been end-of-lifed by NVidia so it will not be developed going forward:

The Cg Toolkit is a legacy NVIDIA toolkit no longer under active development or support. Cg 3.1 is our last release and while we continue to make it available to developers, we do not recommend using it in new development projects because future hardware features may not be supported.

So I think the best answer would be No.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top