Skip to content

Commit

Permalink
Add TODO regarding creation of multiple windows
Browse files Browse the repository at this point in the history
We currently do not support creation of multiple windows: various
objects may end up "interfering" with each other, resulting in
unexpected behavior. Add a TODO and a note to the code to address this
eventually.
  • Loading branch information
d-e-s-o committed Nov 24, 2023
1 parent 3ada46f commit 610629e
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/opengl/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,26 @@ fn window_size(window: &WinitWindow) -> (NonZeroU32, NonZeroU32) {
}

/// The Tetris window.
///
/// # Notes
/// Please note that currently the creation of multiple windows (at the
/// same time) is not a supported workflow.
pub(crate) struct Window {
/// The underlying `winit` window.
window: WinitWindow,
/// The OpenGL surface that is used for rendering.
surface: Surface<WindowSurface>,
/// The OpenGL context used for double buffering.
// TODO: It may be wrong to keep the context current: when creating
// multiple windows we end up with confusion surrounding created
// textures, for example, where destruction of the first window
// may invalidate textures in the second (because the second
// window's context is what is active).
// We may need it stored as deactivated and the only activate it
// for various operations (including rendering). However, this
// likely requires a larger API redesign, because texture
// creation and similar would need to be somehow tied to the
// window with an active context.
context: PossiblyCurrentContext,
}

Expand Down

0 comments on commit 610629e

Please sign in to comment.