Code Monkey home page Code Monkey logo

glium_text's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

glium_text's Issues

Does not compile with old glium

Compiling the unchanged git clone gives errors about different types in glutin 0.3.7:

% cargo build
    Updating registry `https://github.com/rust-lang/crates.io-index`
   Compiling glutin v0.3.7
   Compiling image v0.3.15
/home/daniel/.multirust/toolchains/stable/cargo/registry/src/github.com-121aea75f9ef2ce2/glutin-0.3.7/src/api/osmesa/mod.rs:82:63: 83:69 error: mismatched types:
 expected `*mut libc::c_void`,
    found `*mut libc::types::common::c95::c_void`
(expected enum `libc::c_void`,
    found enum `libc::types::common::c95::c_void`) [E0308]
/home/daniel/.multirust/toolchains/stable/cargo/registry/src/github.com-121aea75f9ef2ce2/glutin-0.3.7/src/api/osmesa/mod.rs:82         let ret = osmesa_sys::OSMesaMakeCurrent(self.context, self.buffer.as_ptr()
/home/daniel/.multirust/toolchains/stable/cargo/registry/src/github.com-121aea75f9ef2ce2/glutin-0.3.7/src/api/osmesa/mod.rs:83                                                 as *mut libc::c_void, 0x1401, self.width
/home/daniel/.multirust/toolchains/stable/cargo/registry/src/github.com-121aea75f9ef2ce2/glutin-0.3.7/src/api/osmesa/mod.rs:82:63: 83:69 help: run `rustc --explain E0308` to see a detailed explanation
/home/daniel/.multirust/toolchains/stable/cargo/registry/src/github.com-121aea75f9ef2ce2/glutin-0.3.7/src/api/x11/window.rs:517:38: 517:63 error: mismatched types:
 expected `*mut libc::c_void`,
    found `*mut libc::types::common::c95::c_void`
(expected enum `libc::c_void`,
    found enum `libc::types::common::c95::c_void`) [E0308]
/home/daniel/.multirust/toolchains/stable/cargo/registry/src/github.com-121aea75f9ef2ce2/glutin-0.3.7/src/api/x11/window.rs:517                 (display.xlib.XFree)(hint as *mut libc::c_void);
                                                                                                                                                                     ^~~~~~~~~~~~~~~~~~~~~~~~~
/home/daniel/.multirust/toolchains/stable/cargo/registry/src/github.com-121aea75f9ef2ce2/glutin-0.3.7/src/api/x11/window.rs:517:38: 517:63 help: run `rustc --explain E0308` to see a detailed explanation
error: aborting due to 2 previous errors

Bumping the versions to the latest crates seems to fix the problem:

diff --git a/Cargo.toml b/Cargo.toml
index d0351e3..b2ad520 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -7,11 +7,11 @@ keywords = ["text", "opengl"]
 license = "MIT"

 [dependencies]
-freetype-sys = "0.1"
-libc = "0.1"
+freetype-sys = "0.2"
+libc = "0.2"

 [dependencies.glium]
-version = "0.9"
+version = "0.12"
 default-features = false
 features = ["cgmath"]

@@ -19,5 +19,5 @@ features = ["cgmath"]
 cgmath = "0.2"

 [dev-dependencies.glium]
-version = "0.9"
+version = "0.12"
 features = ["glutin"]

Panic in OS X

thread '<main>' panicked at 'called `Result::unwrap()` on an `Err` value: CompilationError("ERROR: 0:2: \'\' :  version \'110\' is not supported\nERROR: 0:3: \'\' :  #version required and missing.\nERROR: 0:4: \'attribute\' : syntax error: syntax error\n")', ../src/libcore/result.rs:731

https://github.com/tomaka/glium_text/blob/master/src/lib.rs#L226

Need add 140 version shader:

#version 140

uniform mat4 matrix;
in vec2 position;
in vec2 tex_coords;

out vec2 v_tex_coords;

void main() {
    gl_Position = matrix * vec4(position, 0.0, 1.0);
    v_tex_coords = tex_coords;
}

and

#version 140
in vec2 v_tex_coords;
out vec4 f_color;
uniform vec4 color;
uniform sampler2D tex;
void main() {
    f_color = vec4(color.rgb, color.a * texture(tex, v_tex_coords));
    if (f_color.a <= 0.01) {
        discard;
    }
}

Quality of rendered text is very bad

When I run the hello_world example the rendered text looks really bad (at least on my computer). Here is a screenshot:

Screenshot

I have very little familiarity with freetype so I don't really know how to fix this.

Facade not implemented for GlutinFacade

When running both my own code and the hello world example provided, verbatim, Rust appears unable to find the glium::backend::Facade trait or glium::Surface, regardless of the fact that I have glium::Surface and glium::DisplayBuild used.

src/main.rs:14:18: 14:45 error: the trait `glium::backend::Facade` is not implemented for the type `glium::backend::glutin_backend::GlutinFacade` [E0277]
src/main.rs:14     let system = glium_text::TextSystem::new(&display);
                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~
src/main.rs:14:18: 14:45 help: run `rustc --explain E0277` to see a detailed explanation
src/main.rs:14:18: 14:45 note: required by `glium_text::TextSystem::new`
src/main.rs:16:16: 16:44 error: the trait `glium::backend::Facade` is not implemented for the type `glium::backend::glutin_backend::GlutinFacade` [E0277]
src/main.rs:16     let font = glium_text::FontTexture::new(&display, &include_bytes!("font.ttf")[..], 70).unwrap();
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/main.rs:16:16: 16:44 help: run `rustc --explain E0277` to see a detailed explanation
src/main.rs:16:16: 16:44 note: required by `glium_text::FontTexture::new`
src/main.rs:36:9: 36:25 error: the trait `glium::Surface` is not implemented for the type `glium::Frame` [E0277]
src/main.rs:36         glium_text::draw(&text, &system, &mut target, matrix, (1.0, 1.0, 0.0, 1.0));

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.