mirror of
https://github.com/eliasstepanik/imgui-rs.git
synced 2026-01-11 13:38:35 +00:00
imgui_glow_renderer::AutoRender::gl is now an Rc<glow::Context>.
It can be cloned and stored on drawing callbacks, for example.
This commit is contained in:
parent
2fcfdd55f4
commit
1484742ab5
@ -45,7 +45,7 @@
|
|||||||
//! is sRGB (if you don't know, it probably is) the `internal_format` is
|
//! is sRGB (if you don't know, it probably is) the `internal_format` is
|
||||||
//! one of the `SRGB*` values.
|
//! one of the `SRGB*` values.
|
||||||
|
|
||||||
use std::{borrow::Cow, error::Error, fmt::Display, mem::size_of, num::NonZeroU32};
|
use std::{borrow::Cow, error::Error, fmt::Display, mem::size_of, num::NonZeroU32, rc::Rc};
|
||||||
|
|
||||||
use imgui::{internal::RawWrapper, DrawCmd, DrawData, DrawVert};
|
use imgui::{internal::RawWrapper, DrawCmd, DrawData, DrawVert};
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ type GlUniformLocation = <Context as HasContext>::UniformLocation;
|
|||||||
/// OpenGL context is still available to the rest of the application through
|
/// OpenGL context is still available to the rest of the application through
|
||||||
/// the [`gl_context`](Self::gl_context) method.
|
/// the [`gl_context`](Self::gl_context) method.
|
||||||
pub struct AutoRenderer {
|
pub struct AutoRenderer {
|
||||||
gl: glow::Context,
|
gl: Rc<glow::Context>,
|
||||||
texture_map: SimpleTextureMap,
|
texture_map: SimpleTextureMap,
|
||||||
renderer: Renderer,
|
renderer: Renderer,
|
||||||
}
|
}
|
||||||
@ -87,7 +87,7 @@ impl AutoRenderer {
|
|||||||
let mut texture_map = SimpleTextureMap::default();
|
let mut texture_map = SimpleTextureMap::default();
|
||||||
let renderer = Renderer::initialize(&gl, imgui_context, &mut texture_map, true)?;
|
let renderer = Renderer::initialize(&gl, imgui_context, &mut texture_map, true)?;
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
gl,
|
gl: Rc::new(gl),
|
||||||
texture_map,
|
texture_map,
|
||||||
renderer,
|
renderer,
|
||||||
})
|
})
|
||||||
@ -96,7 +96,7 @@ impl AutoRenderer {
|
|||||||
/// Note: no need to provide a `mut` version of this, as all methods on
|
/// Note: no need to provide a `mut` version of this, as all methods on
|
||||||
/// [`glow::HasContext`] are immutable.
|
/// [`glow::HasContext`] are immutable.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn gl_context(&self) -> &glow::Context {
|
pub fn gl_context(&self) -> &Rc<glow::Context> {
|
||||||
&self.gl
|
&self.gl
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user