pub struct Renderer { /* private fields */ }
Expand description
The main Renderer
type.
Implementations§
Source§impl Renderer
impl Renderer
Sourcepub fn new(gl: GlContext) -> Result<Renderer>
pub fn new(gl: GlContext) -> Result<Renderer>
Creates a new renderer object.
You need to provide the OpenGL context yourself.
Sourcepub fn with_builder(gl: GlContext, builder: &ContextBuilder) -> Result<Renderer>
pub fn with_builder(gl: GlContext, builder: &ContextBuilder) -> Result<Renderer>
Creates a new renderer object.
Just like new()
but you can specify context parameters.
Sourcepub fn gl_context(&self) -> &GlContext
pub fn gl_context(&self) -> &GlContext
Gets a reference to the OpenGL context.
Sourcepub fn set_background_color(&mut self, color: Option<Color>)
pub fn set_background_color(&mut self, color: Option<Color>)
Sets the default background color.
The set color will be used for glClear(GL_COLOR_BUFFER_BIT)
.
Set to None
to avoid this, and use easy_imgui::UiBuilder::pre_render
to do whatever clearing
you need, if anything.
Sourcepub fn set_matrix(&mut self, matrix: Option<Matrix3<f32>>)
pub fn set_matrix(&mut self, matrix: Option<Matrix3<f32>>)
Sets the 2D (3x3) matrix transformation for the UI display.
If you set this matrix to Some
then it is your responsibility to also call the appropriate gl.viewport()
.
Sourcepub fn background_color(&self) -> Option<Color>
pub fn background_color(&self) -> Option<Color>
Gets the background color.
Sourcepub fn set_size(&mut self, size: Vector2, scale: f32)
pub fn set_size(&mut self, size: Vector2, scale: f32)
Sets the UI size, in logical units, and the scale factor.
Sourcepub fn do_frame<A: UiBuilder>(&mut self, app: &mut A)
pub fn do_frame<A: UiBuilder>(&mut self, app: &mut A)
Builds and renders a UI frame, using the app
easy_imgui::UiBuilder
.
Sourcepub fn unmap_tex(tex: TextureId) -> Option<Texture>
pub fn unmap_tex(tex: TextureId) -> Option<Texture>
Gets an OpenGL texture from an ImGui texture.