Anyone seen this error before?

I am trying to complie and link an OpenGL shader on a Nvidia Quadro 3000 (81.67 driver) and getting the following error…

<stdlib><9487> : error C5100: unknown semantics "FACE" specified for "gl_FrontFacing"

The shader has the following line in it…

if (!gl_FrontFacing) normal = -normal;

Now I assume the error is from this line but what does it mean “semantics “FACE””??

That’s in a fragment shader, right?
Sounds like the chip on that board doesn’t support gl_FrontFacing.
In that case here’s a trick for a workaround by “abusing” a normally unused color varying.

In the vertex shader add

gl_FrontSecondaryColor = vec4(1.0);
gl_BackSecondaryColor  = vec4(0.0);

In the fragment shader replace the if (!gl_FrontFacing) with

if (gl_SecondaryColor.r < 0.5)
{
  normal = -normal;
}

Sounds like the chip on that board doesn’t support gl_FrontFacing

That is the first thing that crossed my mind but its a pretty new Nvidia card and its a pretty odd error for a call thats not supported… so I thought I would ask.

Thanks for the tip, I will give it a try.

>>but its a pretty new Nvidia card<<
Not really. According to this document it’s still based on the previous chip generation. http://developer.nvidia.com/object/nv_ogl2_support.html
The workaround is mentioned in there as well.

You are correct sir… straight out of the PDF:

The built-in fragment shader varying parameter gl_FrontFacing is supported by
GeForce 6 Series and NV4xGL-based Quadro FX GPUs but not GeForce FX and
NV3xGL-based Quadro FX GPUs.

and the 3000 is indeed a NV3xGL-based Quadro card. Thanks.

Relic one more quick question, in order to get that work around to work you need to call:

glEnable(GL_VERTEX_PROGRAM_TWO_SIDE);

Which from the docs I can find allows you to use gl_BackColor and gl_BackSecondaryColor in your vertex programs.

Does it do anything else? In other words, are there any side effects I need to be watching here or special cases I need to be handling?

Why doesn’t it just pick up the two sided lighting model parameter as specified by:-
glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 1);
???
Why a new state token?

That’s not “new”, it’s six years old. :wink: I don’t know why the vertex_program specs haven’t reused the light model state either.
I think it really only enables the back color routing from vertex to fragment shader.