PDA

View Full Version : gl_FrontFacing Mystery



Steven Walker
03-31-2006, 05:00 PM
Hi,
I have a shader that works great on all the machines I've tested except for a couple of laptops. There are 4 laptops each with an nVidia Quadro FX Go 1400 card... two of them render fine, the other two don't.

The reason the shader does not work appears to be related to gl_FrontFacing. If I replace gl_FrontFacing with just a constant bool (like 'true') then it works fine... but of course I don't get the benefit of detecting the face direction.

I've installed the latest driver for the card (with assistance from laptopvideo2go.com) but it still does not work. What else should I be looking for? I've looked all over nVidia's website, but can't find anything that remotely helps.

Thanks in advance!

Walker

jide
04-01-2006, 03:31 AM
This might be a driver issue.

shelll
04-02-2006, 09:10 AM
not every quadro supports gl_FrontFacing in fragment shader.

MalcolmB
04-03-2006, 12:22 PM
Yes as shelll said not all cards support gl_FrontFacing.
One trick you can use is enable GL_VERTEX_PROGRAM_TWO_SIDE_ARB

Then in your vertex shader write a 1 to gl_FrontSecondaryColor.a and 0 to gl_BackSecondaryColor.a.

In your pixel shader gl_SecondaryColor.a will tell you if your polygon is front or back facing.

Relic
04-04-2006, 12:50 AM
Read this: http://developer.nvidia.com/object/nv_ogl2_support.html

Steven Walker
04-10-2006, 10:12 AM
Thanks for the tips. I got it working using the GL_VERTEX_PROGRAM_TWO_SIDE trick, but is this safe to use? Will it work on all graphics cards?