|
片段着色器:
static const char fragmentShaderSource_withBaseTexture[] =
"uniform sampler2D osgShadow_baseTexture; \n"
"uniform sampler2DShadow osgShadow_shadowTexture; \n"
"uniform vec2 osgShadow_ambientBias; \n"
"\n"
"void main(void) \n"
"{ \n"
" vec4 color = gl_Color * texture2D( osgShadow_baseTexture, gl_TexCoord[0].xy ); \n"
" gl_FragColor = color * (osgShadow_ambientBias.x + shadow2DProj( osgShadow_shadowTexture, gl_TexCoord[1] ) * osgShadow_ambientBias.y); \n"
"}\n";
问题:
1.gl_TexCoord[1] 代表的是对纹理单元1进行采样的坐标,用于比较纹理中深度的,是否理解正确?
2.gl_TexCoord[1] 是OpenGL系统自动设置的吗?那它数据从哪里获取到的? |
|