rust-windowing/glutin

How do i use mutisampiling on glutin >= 0.30?

ar37-rs opened this issue · 8 comments

How do i use mutisampiling on glutin >= 0.30?

You pass this to the config

pub fn with_sample_buffers(mut self, sample_buffers: u8) -> Self {

And latter you can check how many of them you have by calling

fn sample_buffers(&self) -> u8;

@kchibisov I tired cargo run --example window and set with_sample_buffers(8) it gives me error like so:

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error { raw_code: None, raw_os_message: None, kind: BadConfig }', glutin_examples/examples/window.rs:37:61
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

GL Version: OpenGL 4.1

It could mean that you don't have that many sample buffers. Try something lower, since it's a count of buffers. Usually 1, 2, and 4. You got a note that you've passed a config that doesn't make much sense on that platform.

I think I've got your issue. I'll take a look. You want 8 samples for a buffer in a sample buffer and not sample buffers amount.

@kchibisov, exactly. I meant anti-aliasing

If there's a doc or quote for that (how to set anti-aliasing) on the exmaple, that would be nice.

@kchibisov On glutin 0.29.1 there's a simple way how to do that:

#[inline]
    pub fn with_multisampling(mut self, samples: u16) -> Self {
        self.pf_reqs.multisampling = match samples {
            0 => None,
            _ => {
                assert!(samples.is_power_of_two());
                Some(samples)
            }
        };
        self
    }

Could you take a look at #1463? I think it should work.