In Cg semantics are a way to alias attributes and varyings with certain built-in fixed-function attributes and varyings. A Cg attribute is first and foremost just a generic vertex attribute without any semantic. But in OpenGL (well, only in old and deprecated OpenGL) you have certain fixed-function attributes that carry, well, a semantic. E.g. the vertex position is set with glVertex
or glVertexPointer
, while a vertex's normal is set with glNormal
or glNormalPointer
. By giving a previously plain generic attribute the semantic POSITION
or NORMAL
in Cg, you can make it source it's values from such a fixed-function attribute channel.
In GLSL there are in turn built-in vertex attribute variables that contain the values of the deprecated fixed-function attributes, e.g. gl_Vertex
, gl_Normal
, ... for the position, normal and other semantics. But like said those fixed-function attribute channels are actually deprecated and their use in modern OpenGL is discouraged (or even prohibited in a core profile). What you should instead use is the generic vertex attributes, set with glVertexAttrib
and glVertexAttribPointer
. Those don't carry an actual semantic and only get their semantic by the shader using them in a particular way. But if you need to port an older application over from Cg to GLSL, then using the deprecated builtin attributes like gl_Vertex
or gl_Normal
and the like is the best subsitute for Cg's attribute semantics like POSITION
or NORMAL
.
In the same way there are certain varyings that carry a special meaning and need to be treated specially, like the clip-space position (semantic POSITION
?). Those correspond to special varying variables you can write to in the vertex shader, like gl_Position
in this case. And in deprecated OpenGL there are also other varying variables that can be written to and that correspond to certain fixed-function varyings, like gl_TexCoord[i]
and the TEXCOORDi
semantic. When using those you can easily interface shaders with fixed-function stages and e.g. use a vertex shader but fixed-function fragment processing.
So to sum up those Cg semantics actually correspond to special pre-defined attribute and varying variables in GLSL. But in modern OpenGL all of those special vertex attributes and most of those special varying variables don't exist anymore. But I advise you to first delve a little deeper into how GLSL and Cg works in practice, since as you see porting between those two is not as simple as subsitituting some keywords.