Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken Documentation links? #97

Open
EggShark opened this issue Mar 1, 2023 · 0 comments
Open

Broken Documentation links? #97

EggShark opened this issue Mar 1, 2023 · 0 comments

Comments

@EggShark
Copy link

EggShark commented Mar 1, 2023

Im writing a game engine and using wgpu_glyph for the text rendering and here is the snippet of my code

         render_items.transformed_text.iter()
            .map(|text| (wgpu_glyph::Section{
                screen_position: (text.position.x, text.position.y),
                bounds: (self.size.width as f32, self.size.height as f32),
                text: vec![wgpu_glyph::Text::new(&text.text).with_color(text.colour.to_raw())],
                ..Default::default()
                }, text.transformation))
            .for_each(|(section, transform)| {
                let text_transform = unflatten_matrix(transform);
                let ortho = unflatten_matrix(orthographic_projection(self.size.width, self.size.height));
                let transform = flatten_matrix(ortho * text_transform);
                self.glyph_brush.queue(section);
                self.glyph_brush.draw_queued_with_transform(
                    &self.device, &mut staging_belt, &mut encoder, &view, &self.camera_bind_group, transform,
                ).unwrap();
            });
        let text_sections = render_items.text
            .iter()
            .map(|text| wgpu_glyph::Section{
                screen_position: (text.position.x, text.position.y),
                bounds: (self.size.width as f32, self.size.height as f32),
                text: vec![wgpu_glyph::Text::new(&text.text).with_color(text.colour.to_raw())],
                ..Default::default()
            })
            .collect::<Vec<wgpu_glyph::Section>>();
        text_sections.into_iter().for_each(|s| self.glyph_brush.queue(s));
        self.glyph_brush.draw_queued(&self.device, &mut staging_belt, &mut encoder, &view, &self.camera_bind_group, self.size.width, self.size.height).unwrap();

This produces a strange result where the text that is supposed to have no transformations (other than the orthographic transformation) So i went to the documentation for the glyph_brush and under queue it states Benefits from caching, see caching behaviour; however, when I click the link to see this caching behavior it links nowhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant