Enabling GL_VERTEX_PROGRAM_TWO_SIDE

What it says on the tin: a place to discuss proposed new features.
Post Reply
User avatar
wernermarius
Gnoblar
Posts: 12
Joined: Fri May 25, 2007 8:36 am

Enabling GL_VERTEX_PROGRAM_TWO_SIDE

Post by wernermarius »

When writing to gl_BackColor inside a GLSL vertex shader, it is ignored as long as no call to glEnable(GL_VERTEX_PROGRAM_TWO_SIDE) was made. So the fragment shader's gl_Color always ends up with the value of gl_FrontColor.

Would it be a problem to enable GL_VERTEX_PROGRAM_TWO_SIDE by default (i.e. in GLRenderSystem::initGL) ?
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 67
Contact:

Post by sinbad »

Have you tried this (in your GLSL)?

Code: Select all

#extension GL_VERTEX_PROGRAM_TWO_SIDE : enable
User avatar
wernermarius
Gnoblar
Posts: 12
Joined: Fri May 25, 2007 8:36 am

Post by wernermarius »

sinbad wrote:Have you tried this (in your GLSL)?

Code: Select all

#extension GL_VERTEX_PROGRAM_TWO_SIDE : enable
If I do that in my vertex shader, I get

Code: Select all

WARNING: 0:2: extension 'GL_VERTEX_PROGRAM_TWO_SIDE' is not supported
However, I have recompiled Ogre with a change to GLRenderSystem::initGL(), where I simpy call glEnable(GL_VERTEX_PROGRAM_TWO_SIDE) at the end. With that, everything works just fine (without adding the #extension... in my vertex shader).
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 67
Contact:

Post by sinbad »

Ok - I think in practice this option has to be a material option rather than enabled globally, because otherwise it will change the behaviour of materials with culling set to off (two sided) where only the front colour is populated. You can of course continue to use your quick hack if you need it.
User avatar
wernermarius
Gnoblar
Posts: 12
Joined: Fri May 25, 2007 8:36 am

Post by wernermarius »

Yes, that sounds very reasonable. I will continue using my hack for the moment...
Post Reply