
626 VII Software Design
uniform sampler2D tex;
out vec4 fragColor;
void main ()
{
vec2 curPos ;
curPos .x = float (int( gl_FragCoord.x) % 32) / 32.0;
curPos .y = float (int( gl_FragCoord.y) % 32) / 32.0;
vec4 color = texture (tex , curPos );
if ( color.w < 0.5)
{
discard ;
}
fragColor = color;
}
Listing 43.5. Polygon stipple fragment shader.
in the shader main. The remainder operator (%) is illegal in GLSL ES, so the texture
coordinate computation would also need to be adjusted accordingly.
43.3 Keeping Code Maintainable across API
Variants
After a code base is ported to a modern core profile of OpenGL, there is still some
work needed to ensure compatibility with ...