View Full Version : Cg and front/back fragments?

10-27-2007, 03:55 PM
Is there any way to differentiate between front and back fragments in Cg like there is in GLSL (gl_FrontColor, gl_BackColor)?

10-28-2007, 05:56 AM
The way I differentiate them is I call one variable "FrontColor" and the other "BackColor".

That way I don't get them mixed up.

Don't know how it works in Cg but I expect it's similar.

10-28-2007, 04:01 PM
Well in GLSL you can set both gl_FrontColor and gl_BackColor in the vertex program and gl_Color in the fragment program will be either the front or back color based on the front/back state of the fragment. I am just wondering Cg has a similar convention.

10-29-2007, 10:54 AM
I figured it out: either vertex program COL0/BCOL0 gets put into COLOR0 in the fragment program if GL_VERTEX_PROGRAM_TWO_SIDE is enabled.