From 1cf83d90721b0fa500a04425b443a3547aee72c9 Mon Sep 17 00:00:00 2001 From: John-Mark Allen Date: Sun, 5 Sep 2021 16:04:36 +0100 Subject: [PATCH] Add type aliases for fully-qualified Context types --- imgui-glow-renderer/src/lib.rs | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/imgui-glow-renderer/src/lib.rs b/imgui-glow-renderer/src/lib.rs index 96070b3..4379d16 100644 --- a/imgui-glow-renderer/src/lib.rs +++ b/imgui-glow-renderer/src/lib.rs @@ -49,6 +49,12 @@ use glow::{Context, HasContext}; pub mod versions; +pub type GlBuffer = ::Buffer; +pub type GlTexture = ::Texture; +pub type GlVertexArray = ::VertexArray; +type GlProgram = ::Program; +type GlUniformLocation = ::Program; + /// Renderer which owns the OpenGL context and handles textures itself. Also /// converts all output colors to sRGB for display. Useful for simple applications, /// but more complicated applications may prefer to use `[Renderer]`, or even @@ -121,11 +127,11 @@ impl Drop for AutoRenderer { pub struct Renderer { shaders: Shaders, state_backup: GlStateBackup, - pub vbo_handle: ::Buffer, - pub ebo_handle: ::Buffer, - pub font_atlas_texture: ::Texture, + pub vbo_handle: GlBuffer, + pub ebo_handle: GlBuffer, + pub font_atlas_texture: GlTexture, #[cfg(feature = "bind_vertex_array_support")] - pub vertex_array_object: ::VertexArray, + pub vertex_array_object: GlVertexArray, pub gl_version: GlVersion, pub has_clip_origin_support: bool, pub is_destroyed: bool, @@ -533,15 +539,9 @@ impl Renderer { /// Then `[gl_texture]` can be called to find the OpenGL texture corresponding to /// that `[imgui::TextureId]`. pub trait TextureMap { - fn register( - &mut self, - gl_texture: ::Texture, - ) -> Option; + fn register(&mut self, gl_texture: GlTexture) -> Option; - fn gl_texture( - &self, - imgui_texture: imgui::TextureId, - ) -> Option<::Texture>; + fn gl_texture(&self, imgui_texture: imgui::TextureId) -> Option; } /// Texture map where the imgui texture ID is simply numerically equal to the @@ -761,9 +761,9 @@ impl GlStateBackup { /// generate shaders which should work on a wide variety of modern devices /// (GL >= 3.3 and GLES >= 2.0 are expected to work). struct Shaders { - program: ::Program, - texture_uniform_location: ::UniformLocation, - matrix_uniform_location: ::UniformLocation, + program: GlProgram, + texture_uniform_location: GlUniformLocation, + matrix_uniform_location: GlUniformLocation, position_attribute_index: u32, uv_attribute_index: u32, color_attribute_index: u32, @@ -1037,7 +1037,7 @@ fn prepare_font_atlas( gl: &Context, mut fonts: imgui::FontAtlasRefMut, texture_map: &mut T, -) -> Result<::Texture, InitError> { +) -> Result { #![allow(clippy::cast_possible_wrap)] let atlas_texture = fonts.build_rgba32_texture();