100 |
|
|
101 |
if GL.hasExtension("GL_ARB_fragment_program"): |
if GL.hasExtension("GL_ARB_fragment_program"): |
102 |
PageSpanPaper.fpDualBlur = GL.createProgram("""!!ARBfp1.0 |
PageSpanPaper.fpDualBlur = GL.createProgram("""!!ARBfp1.0 |
103 |
|
# Computes color = tex0 * tex1 with |
104 |
|
# tex0 blurred near non-white parts of tex1. |
105 |
|
|
106 |
TEMP coord1; |
TEMP coord1; |
107 |
MOV coord1, fragment.texcoord[1]; |
MOV coord1, fragment.texcoord[1]; |
108 |
MOV coord1.w, 4.0; |
MOV coord1.w, 4.0; |
109 |
|
|
110 |
|
# Filter the 'text' texture with and without blurring |
111 |
TEMP tex1, tex1b; |
TEMP tex1, tex1b; |
112 |
TEX tex1, coord1, texture[1], 2D; |
TEX tex1, coord1, texture[1], 2D; |
113 |
TXB tex1b, coord1, texture[1], 2D; |
TXB tex1b, coord1, texture[1], 2D; |
115 |
TEMP coord0; |
TEMP coord0; |
116 |
MOV coord0, fragment.texcoord[0]; |
MOV coord0, fragment.texcoord[0]; |
117 |
|
|
118 |
# Get intensity, invert, and multiply by a big number |
# Map blurred 'text' texture intensity to background LOD bias |
119 |
|
# as follows: |
120 |
|
# 1 -> no bias |
121 |
|
# 0 -> large bias |
122 |
DP4 coord0.w, {-100,-100,-100,300}, tex1b; |
DP4 coord0.w, {-100,-100,-100,300}, tex1b; |
123 |
|
|
124 |
|
# Filter background texture with the proper LOD bias |
125 |
TEMP tex0; |
TEMP tex0; |
126 |
TXB tex0, coord0, texture[0], 2D; |
TXB tex0, coord0, texture[0], 2D; |
127 |
|
|