Trait gfx_gtk::GlRenderCallback [−][src]
pub trait GlRenderCallback<CF, DF> where
CF: Formatted<View = GtkTargetColorView>,
CF::Channel: TextureChannel + RenderChannel,
CF::Surface: RenderSurface + TextureSurface,
DF: Formatted,
DF::Channel: TextureChannel + RenderChannel,
DF::Surface: DepthSurface + TextureSurface, { fn render(
&mut self,
gfx_context: &mut GlGfxContext,
viewport: &Viewport,
render_target: &GlFrameBuffer<CF>,
depth_buffer: &GlDepthBuffer<DF>
) -> Result<GlRenderCallbackStatus>; fn resize(
&mut self,
_gfx_context: &mut GlGfxContext,
_viewport: Viewport
) -> Result<GlRenderCallbackStatus> { ... } }
Implement custom render behaviour for the GlArea
CF
color format of the offline targetDF
depth format of the offline target
Required Methods
fn render(
&mut self,
gfx_context: &mut GlGfxContext,
viewport: &Viewport,
render_target: &GlFrameBuffer<CF>,
depth_buffer: &GlDepthBuffer<DF>
) -> Result<GlRenderCallbackStatus>
&mut self,
gfx_context: &mut GlGfxContext,
viewport: &Viewport,
render_target: &GlFrameBuffer<CF>,
depth_buffer: &GlDepthBuffer<DF>
) -> Result<GlRenderCallbackStatus>
Invoked when the GlArea needs rendering (after an expose or queue_draw event)
gfx_context
Gfx device, factory, encoder attached to the current Gl contextviewport
size of the GlArearender_target
the offscreen target to render todepth_buffer
the offscreen depth buffer associated to therender_target
After rendering, the result should contain either:
*Ok(Continue)
to proceed with the postprocessing step
*Ok(Skip)
to blit directly to the GlArea buffer
*Err(_)
will stop the rendering of the requested frame
Gtk may or may not retain the previous state of the frame
Provided Methods
fn resize(
&mut self,
_gfx_context: &mut GlGfxContext,
_viewport: Viewport
) -> Result<GlRenderCallbackStatus>
&mut self,
_gfx_context: &mut GlGfxContext,
_viewport: Viewport
) -> Result<GlRenderCallbackStatus>
Invoked when the GlArea has been resized
gfx_context
Gfx device, factory, encoder attached to the current Gl contextviewport
size of the GlArea after resizing Should returnContinue