Skip to main content

Crate dear_imgui_glow

Crate dear_imgui_glow 

Source
Expand description

Glow (OpenGL) renderer for Dear ImGui

This crate provides a Glow-based renderer for Dear ImGui, allowing you to render Dear ImGui interfaces using the Glow OpenGL abstraction.

§Features

  • Basic rendering: Render Dear ImGui draw data using OpenGL
  • Texture support: Handle font textures and user textures
  • Multi-viewport support: Support for multiple windows (feature-gated)
  • OpenGL compatibility: Support for OpenGL 2.1+ and OpenGL ES 2.0+

§Example

use dear_imgui_rs::Context;
use dear_imgui_glow::GlowRenderer;
use glow::HasContext;

// Initialize your OpenGL context and Dear ImGui context
let gl = unsafe { glow::Context::from_loader_function(|s| {
    // Your OpenGL loader function
    std::ptr::null()
}) };
let mut imgui = Context::create();

// Create the renderer (simple usage)
let mut renderer = GlowRenderer::new(gl, &mut imgui).unwrap();

// In your render loop:
// imgui.new_frame();
// ... build your UI ...
// let draw_data = imgui.render();
// renderer.render(draw_data).unwrap();

Re-exports§

pub use glow;

Structs§

GlVersion
OpenGL version information
GlowRenderer
Main renderer for Dear ImGui using Glow (OpenGL)
GlslVersion
GLSL version information
SimpleTextureMap
Simple texture map implementation using a HashMap with modern texture management

Enums§

InitError
Errors that can occur during renderer initialization
RenderError
Errors that can occur during rendering

Traits§

TextureMap
Trait for managing texture mappings with modern Dear ImGui texture system

Functions§

create_texture_from_alpha
Create a texture from raw alpha data (single channel)
create_texture_from_rgba
Create a texture from raw RGBA data
update_imgui_texture
Update texture from ImGui texture data (similar to ImGui_ImplOpenGL3_UpdateTexture)
update_texture
Update a texture with new data

Type Aliases§

GlBuffer
GlProgram
GlTexture
GlUniformLocation
GlVertexArray
InitResult
Result type for initialization operations
RenderResult
Result type for rendering operations