Debian Codegraph @

src/core/doc/snippets/code/src_render_renderstates_qmultisampleantialiasing.qdocinc

raw
1 Further, the shader code must use multisampling sampler types and texelFetch() instead
2 of texture().
3
4 For example, if you have code like
5
6 \code
7 #version 150
8
9 uniform sampler2D colorTexture;
10 in vec2 texCoord;
11 out vec4 fragColor;
12
13 void main()
14 {
15 fragColor = texture(colorTexture, texCoord);
16 }
17 \endcode
18
19 you can rewrite it as
20
21 \code
22 #version 150
23
24 uniform sampler2DMS colorTexture;
25 in vec2 texCoord;
26 out vec4 fragColor;
27
28 void main()
29 {
30 ivec2 tc = ivec2(floor(textureSize(colorTexture) * texCoord));
31 vec4 c = texelFetch(colorTexture, tc, 0) +
32 texelFetch(colorTexture, tc, 1) +
33 texelFetch(colorTexture, tc, 2) +
34 texelFetch(colorTexture, tc, 3);
35 fragColor = c / 4.0;
36 }
37 \endcode