pub struct CallbackFn { /* private fields */ }
Expand description

A callback function that can be used to compose an [egui::PaintCallback] for custom WGPU rendering.

The callback is composed of two functions: prepare and paint.

prepare is called every frame before paint, and can use the passed-in wgpu::Device and wgpu::Buffer to allocate or modify GPU resources such as buffers.

paint is called after prepare and is given access to the the wgpu::RenderPass so that it can issue draw commands.

The final argument of both the prepare and paint callbacks is a the paint_callback_resources. paint_callback_resources has the same lifetime as the Egui render pass, so it can be used to store buffers, pipelines, and other information that needs to be accessed during the render pass.

Example

See the custom3d_glow demo source for a detailed usage example.

Implementations

Set the prepare callback

Set the paint callback

Trait Implementations

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more