Use a regular float texture for the font.
authorBernie Innocenti <bernie@codewiz.org>
Wed, 21 Jun 2017 04:51:46 +0000 (00:51 -0400)
committerBernie Innocenti <bernie@codewiz.org>
Wed, 21 Jun 2017 04:51:46 +0000 (00:51 -0400)
Unsigned textures silently fail with Intel... &#@@?!

main.rs
text.rs

diff --git a/main.rs b/main.rs
index a55b7e4fd4ba57c57d35caed1e5f060580e736b6..d4e38b79198cc34d079a0e2622232da8815263f3 100644 (file)
--- a/main.rs
+++ b/main.rs
@@ -72,6 +72,7 @@ fn main() {
         .with_srgb(Some(true))
         .with_title(format!("MandelWow"))
         .build_glium()
+        //.build_glium_debug(glium::debug::DebugCallbackBehavior::PrintAll)
         .unwrap();
 
     gl_info(&display);
diff --git a/text.rs b/text.rs
index 82d4d1703a79da5bd4efed53dc5c9205f4493f2b..bf19aa2ad273aff0eb9cd544153cac4a90bf0982 100644 (file)
--- a/text.rs
+++ b/text.rs
@@ -13,7 +13,7 @@ struct Vertex {
 implement_vertex!(Vertex, position, tex_coords);
 
 pub struct Text<'a> {
-    tex: texture::UnsignedTexture2d,
+    tex: texture::Texture2d,
     vertex_buffer: glium::VertexBuffer<Vertex>,
     index_buffer: glium::IndexBuffer<u16>,
     program: glium::Program,
@@ -34,10 +34,10 @@ impl<'a> Text<'a> {
             height: h,
             format: glium::texture::ClientFormat::U8,
         };
-        let tex = glium::texture::UnsignedTexture2d::with_format(
+        let tex = glium::texture::Texture2d::with_format(
             display,
             image,
-            glium::texture::UncompressedUintFormat::U8,
+            glium::texture::UncompressedFloatFormat::U8,
             glium::texture::MipmapsOption::NoMipmap,
         ).unwrap();
 
@@ -94,13 +94,13 @@ impl<'a> Text<'a> {
                     // Characters are arranged in a 16x16 square.
                     int xpos = index % 16;
                     int ypos = index / 16;
-                    v_tex_coords = (tex_coords) / 16.0 + vec2(xpos / 16., ypos / 16.);
+                    v_tex_coords = (tex_coords + vec2(xpos, ypos)) / 16.;
                 }
             ",
 
             fragment: "
                 #version 140
-                uniform usampler2D tex;
+                uniform sampler2D tex;
                 uniform vec4 bgcolor;
                 uniform vec4 fgcolor;