summaryrefslogtreecommitdiffstats
path: root/src/core/doc/snippets/code/src_render_renderstates_qmultisampleantialiasing.qdocinc
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/doc/snippets/code/src_render_renderstates_qmultisampleantialiasing.qdocinc')
-rw-r--r--src/core/doc/snippets/code/src_render_renderstates_qmultisampleantialiasing.qdocinc35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/core/doc/snippets/code/src_render_renderstates_qmultisampleantialiasing.qdocinc b/src/core/doc/snippets/code/src_render_renderstates_qmultisampleantialiasing.qdocinc
new file mode 100644
index 000000000..9c530382f
--- /dev/null
+++ b/src/core/doc/snippets/code/src_render_renderstates_qmultisampleantialiasing.qdocinc
@@ -0,0 +1,35 @@
+Further, the shader code must use multisampling sampler types and texelFetch() instead
+ of texture().
+
+\oldcode
+
+#version 150
+
+uniform sampler2D colorTexture;
+in vec2 texCoord;
+out vec4 fragColor;
+
+void main()
+{
+ fragColor = texture(colorTexture, texCoord);
+}
+
+\newcode
+
+#version 150
+
+uniform sampler2DMS colorTexture;
+in vec2 texCoord;
+out vec4 fragColor;
+
+void main()
+{
+ ivec2 tc = ivec2(floor(textureSize(colorTexture) * texCoord));
+ vec4 c = texelFetch(colorTexture, tc, 0) +
+ texelFetch(colorTexture, tc, 1) +
+ texelFetch(colorTexture, tc, 2) +
+ texelFetch(colorTexture, tc, 3);
+ fragColor = c / 4.0;
+}
+
+\endcode