- // flip the image horizontally by changing the x component of the texture coordinate
- if( uIsBackImageVisible == 1.0 )\n
- gl_FragColor = texture2D( sTexture, vec2( sTextureRect.p+sTextureRect.s-vTexCoord.x, vTexCoord.y ) ) * uColor; \n
- else\n
- gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor;\n
- // display book spine, a stripe of shadowed texture
- float pixelPos = (vTexCoord.x-sTextureRect.s)*uPageWidth; \n
- if(pixelPos < uSpineShadowParameter.x) \n
+ if( gl_FrontFacing )\n // display front side
+ {\n
+ gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor;\n
+ }\n
+ else\n // display back side, flip the image horizontally by changing the x component of the texture coordinate
+ {\n
+ gl_FragColor = texture2D( sTexture, vec2( 1.0 - vTexCoord.x, vTexCoord.y ) ) * uColor;\n
+ }\n
+ // display book spine, a stripe of shadowed texture
+ float pixelPos = vTexCoord.x * uSize.x;\n
+ if( pixelPos < uSpineShadowParameter.x )\n