Get the vertex_id variable in a NVIDIA CG vertex shader to create Index Map

483 views Asked by At

I need to generate an Index Map (Index list) containing the id of each projected vertex. My shader code is based on NVIDIA CG 3.0 and I can't find in the documentation the build-in variable name to extract the id of each vertex.

In GLSL is something like: gl_VertexID. What is the equivalent in CG? If is not accessible, can you think of other way of generating an Index Map that doesn't involve extra storage?

1

There are 1 answers

0
a.lasram On

CG uses semantic binding as in HLSL. I think the semantic is VERTEXID, if you can't find an example in your CG toolkit, look in directx examples for SV_VertexID and follow a similar syntax for CG VERTEXID.