You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm struggling to understand how to use 'glx' in this crate. Looks really cool, I am just struggling to fully figure it out. How do I get the framebuffer properly? How do I set up GLX?
let (conn, screen_num) = x11rb::connect(None)?;
let screen = &conn.setup().roots[screen_num];
let win_id = conn.generate_id()?;
let ctx_id = conn.generate_id()?;
let colormap_id = conn.generate_id()?;
// Choose framebuffer config. This is wrong?
let fb_configs = glx::get_fb_configs(&conn, screen.root)?.reply()?;
let fb_config = fb_configs.property_list[0];
// Create OpenGL context
glx::create_new_context(&conn, ctx_id, fb_config, screen.root, 0x8014, 0, true)?;
// Create colormap
conn.create_colormap(ColormapAlloc::NONE, colormap_id, screen.root, fb_config)?;
let win_aux = &CreateWindowAux::new()
.background_pixel(screen.white_pixel)
.event_mask(EventMask::KEY_PRESS)
.colormap(colormap_id);
conn.create_window(
COPY_DEPTH_FROM_PARENT,
win_id,
screen.root,
0,
0,
width,
height,
0,
WindowClass::INPUT_OUTPUT,
fb_config,
&win_aux,
)?;
conn.map_window(win_id)?;
conn.flush()?;
glx::make_context_current(&conn, 0, win_id, win_id, ctx_id)?.reply()?;
// What else to do?
'game: loop {
if let event: Event = conn.wait_for_event().expect("Couldn't get event") {
match event {
Event::KeyPress(key) => {
match key.detail {
9 => break 'game, // Esc
_ => {}
}
}
_ => {}
}
}
}
The text was updated successfully, but these errors were encountered:
Naginipython
changed the title
Examples on how to use 'glx' feature
Example help on how to use 'glx' feature
Oct 24, 2024
Naginipython
changed the title
Example help on how to use 'glx' feature
Example help needed on how to use 'glx' feature
Oct 24, 2024
TL;DR: Do not try to use the X11 GLX protocol directly. Use GLX through mesa instead.
Sorry, but the short version is "you do not". I am not 100% sure, but I think you would need the GLX X11 extension if you are implementing GLX. So, e.g. mesa would need this to talk to the X11 server. You would then use "proper GLX" through mesa.
Sadly, Google didn't give me anything more useful than this. I think that most of the GLX X11 extension is not even used anymore. The phrase "indirect GLX" comes to mind. Google found that on https://en.wikipedia.org/wiki/AIGLX but that does not really say anything helpful.
I'm struggling to understand how to use 'glx' in this crate. Looks really cool, I am just struggling to fully figure it out. How do I get the framebuffer properly? How do I set up GLX?
The text was updated successfully, but these errors were encountered: