commit 1e614ab7a6da0aec554a4fffcf90ef3114a6d79a
parent 5304bdd2a2366231af57e1867b457df68b3e4aef
Author: Brian Swetland <swetland@frotz.net>
Date: Wed, 30 Jan 2013 18:42:56 -0800
vse2012 can't cope with c++11 raw string literals...
Diffstat:
M | debugtext.cc | | | 91 | ++++++++++++++++++++++++++++++++++++++----------------------------------------- |
1 file changed, 44 insertions(+), 47 deletions(-)
diff --git a/debugtext.cc b/debugtext.cc
@@ -61,53 +61,50 @@ static void dtc_init(DebugTextCell *data, int w, int h) {
}
}
-static const char *vsrc = R"(
-uniform mat4 uMVP;
-uniform sampler2D uTexture1;
-attribute vec4 aVertex;
-attribute vec4 aTexCoord;
-
-varying vec4 vTexCoord;
-const float cbw = 32.0;
-const float cbh = 32.0;
-
-void main() {
- gl_Position = uMVP * vec4(aVertex.xy,0.0,1.0);
- vTexCoord = aTexCoord;
-}
-)";
-
-static const char *fsrc = R"(
-uniform sampler2D uTexture0;
-uniform sampler2D uTexture1;
-
-varying vec4 vTexCoord; // u, v, cx, cy
-
-// width and height of the "character buffer"
-const float cbw = 32.0;
-const float cbh = 32.0;
-
-// cell count (h & v) for character map
-const float cc = 16.0;
-
-void main() {
- vec2 base, offset;
- float ch;
-
- // look up characer in cbw x cbh character buffer texture
- ch = texture2D(uTexture1, vec2(vTexCoord.z / cbw, vTexCoord.w / cbh)).a
- * 255.0 + 0.001953125;
- //ch = vChar;
-
- // base texcoord of ch (0..255) in cc x cc character map texture
- base = vec2(fract(ch / cc), -floor(ch / cc) / cc);
-
- // scale offset texcoord
- offset = vTexCoord.xy / cc;
-
- gl_FragColor = texture2D(uTexture0, base + offset * vec2(1.0,-1.0));
-}
-)";
+static const char *vsrc =
+"uniform mat4 uMVP;"
+"uniform sampler2D uTexture1;"
+"attribute vec4 aVertex;"
+"attribute vec4 aTexCoord;"
+""
+"varying vec4 vTexCoord;"
+"const float cbw = 32.0;"
+"const float cbh = 32.0;"
+""
+"void main() {"
+" gl_Position = uMVP * vec4(aVertex.xy,0.0,1.0);"
+" vTexCoord = aTexCoord;"
+"}";
+
+static const char *fsrc =
+"uniform sampler2D uTexture0;"
+"uniform sampler2D uTexture1;"
+""
+"varying vec4 vTexCoord; /* u, v, cx, cy */"
+""
+"/* width and height of the character buffer */"
+"const float cbw = 32.0;"
+"const float cbh = 32.0;"
+""
+"/* cell count (h & v) for character map */"
+"const float cc = 16.0;"
+""
+"void main() {"
+" vec2 base, offset;"
+" float ch;"
+""
+" /* look up characer in cbw x cbh character buffer texture */"
+" ch = texture2D(uTexture1, vec2(vTexCoord.z / cbw, vTexCoord.w / cbh)).a"
+" * 255.0 + 0.001953125;"
+""
+" /* base texcoord of ch (0..255) in cc x cc character map texture */"
+" base = vec2(fract(ch / cc), -floor(ch / cc) / cc);"
+""
+" /* scale offset texcoord */"
+" offset = vTexCoord.xy / cc;"
+""
+" gl_FragColor = texture2D(uTexture0, base + offset * vec2(1.0,-1.0));"
+"}";
int DebugText::init(unsigned w, unsigned h) {
cbw = w;