2

I'm using glium in Rust. I want to get the width and the height.

I can't write and understand English well, because I'm Japanese. Maybe my English has some problems so I'm sorry.

javaboy
  • 85
  • 7
  • Width and height of what? Of the OpenGL context? – Alexey S. Larionov Jul 23 '21 at 09:01
  • I want to get the width and the height of the window. (Sorry. I searched about the OpenGL context because I don't know it. But I can't understand the OpenGL context.) – javaboy Jul 23 '21 at 09:13
  • I'm not familiar with `glium`, and I say OpenGL context, because OpenGL doesn't know **anything** about windows. I searched for documentation, and maybe in glium you can use [`get_framebuffer_dimensions`](https://docs.rs/glium/0.30.1/glium/backend/glutin/struct.Display.html#method.get_framebuffer_dimensions) – Alexey S. Larionov Jul 23 '21 at 09:20
  • Thank you. Can you write the comment in the answer section? – javaboy Jul 23 '21 at 09:42

1 Answers1

3

As I mentioned in the comments section, there's a Display::get_framebuffer_dimensions, so if you have the glium::Display object around, you can extract the dimensions of the OpenGL context using it.

pub fn get_framebuffer_dimensions(&self) -> (u32, u32)

Calls get_framebuffer_dimensions on the backend object stored by this context.

Alexey S. Larionov
  • 6,555
  • 1
  • 18
  • 37