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.
Members
TYPEto_refon_open_gl_initon_open_gl_deiniton_open_gl_loston_open_gl_renderconstructgl_versioninvalidate_visualrequest_next_frame_rendering
TYPE
const TYPE: &'static $crate::TypeInfo
The runtime type of this class.
to_ref
fn to_ref(self: &Self) -> $crate::Ref<OpenGlControlBase>
Returns a strong reference to this object.
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.
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.
on_open_gl_lost
fn on_open_gl_lost(self: &Self)
Called when the OpenGL context is lost and cannot be recovered.
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.
construct
fn construct() -> Self
Creates the class data; see ferroui_base::FerroObject::construct.
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).
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()
request_next_frame_rendering
fn request_next_frame_rendering(self: &Self)
Requests that the control be rendered on the next frame.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeOpenGlControlBaseImplExtBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>ReceiverAnyInputElementImplExtInteractiveImplExtLayoutableImplExtFerroObjectImplExtStyledElementImplExtClassDefaultsVisualImplExtErasedDestructorIntoEitherControlImplExtDerefUpcast<T>Upcast<OpenGlControlBase>StaticTypeObjectTypeSubclassable<T>StyledElementImplLayoutableImplInteractiveImplInputElementImplControlImplOpenGlControlBaseImplVisualImplFerroObjectImpl
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.