FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    OpenGlControlBase

    struct · ferroui-opengl · v0.5.0

    struct OpenGlControlBase
    

    Base class for controls that render using OpenGL. Provides infrastructure for OpenGL context management, surface creation, and rendering lifecycle.

    The control automatically manages OpenGL context creation, surface setup, and cleanup.

    Important: Any interaction with GlInterface should only happen within the on_open_gl_init, on_open_gl_deinit, or on_open_gl_render overrides.

    The framework ensures proper OpenGL context synchronization and makes the context current only during these calls. Accessing OpenGL functions outside of them may result in undefined behavior, crashes, or rendering corruption.

    The class is abstract: a deriving class implements on_open_gl_render.

    View source

    Members

    TYPE

    const TYPE: &'static $crate::TypeInfo
    

    The runtime type of this class.

    Source

    to_ref

    fn to_ref(self: &Self) -> $crate::Ref<OpenGlControlBase>
    

    Returns a strong reference to this object.

    Source

    on_open_gl_init

    fn on_open_gl_init(self: &Self, gl: &GlInterface)
    

    Called when the OpenGL context is first created.

    gl is the interface for making OpenGL calls. Use GlInterface::get_proc_address to access additional APIs not covered by GlInterface.

    Source

    on_open_gl_deinit

    fn on_open_gl_deinit(self: &Self, gl: &GlInterface)
    

    Called when the OpenGL context is being destroyed.

    gl is the interface for making OpenGL calls. Use GlInterface::get_proc_address to access additional APIs not covered by GlInterface.

    Source

    on_open_gl_lost

    fn on_open_gl_lost(self: &Self)
    

    Called when the OpenGL context is lost and cannot be recovered.

    Source

    on_open_gl_render

    fn on_open_gl_render(self: &Self, gl: &GlInterface, fb: i32)
    

    Called to render the OpenGL content for the current frame.

    gl is the interface for making OpenGL calls. Use GlInterface::get_proc_address to access additional APIs not covered by GlInterface. fb is the framebuffer ID to render into.

    Source

    construct

    fn construct() -> Self
    

    Creates the class data; see ferroui_base::FerroObject::construct.

    Source

    gl_version

    fn gl_version(self: &Self) -> Option<GlVersion>
    

    Gets the OpenGL version information for the current context: None while the control has no context (the default value of the version in the original).

    Source

    invalidate_visual

    fn invalidate_visual(self: &Self)
    

    Requests that the control be rendered on the next frame; hides the member of the visual, as the original does.

    Deprecated. Use request_next_frame_rendering()

    Source

    request_next_frame_rendering

    fn request_next_frame_rendering(self: &Self)
    

    Requests that the control be rendered on the next frame.

    Source

    Trait implementations

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.