[−][src]Type Definition gfx_gtk::GlRenderContext
type GlRenderContext<CF, DF> = RenderContext<GlDevice, GlFactory, CF, DF>;
render context, specialized for the gfx Gl backend
Methods
impl<CF, DF> GlRenderContext<CF, DF> where
CF: Formatted<View = [f32; 4]>,
CF::Channel: TextureChannel + RenderChannel,
CF::Surface: RenderSurface + TextureSurface,
DF: Formatted,
DF::Channel: TextureChannel + RenderChannel,
DF::Surface: DepthSurface + TextureSurface,
[src]
CF: Formatted<View = [f32; 4]>,
CF::Channel: TextureChannel + RenderChannel,
CF::Surface: RenderSurface + TextureSurface,
DF: Formatted,
DF::Channel: TextureChannel + RenderChannel,
DF::Surface: DepthSurface + TextureSurface,
pub fn new(
aa: AaMode,
widget_width: i32,
widget_height: i32,
postprocess_shader: Option<&[u8]>
) -> Result<GlRenderContext<CF, DF>>
[src]
aa: AaMode,
widget_width: i32,
widget_height: i32,
postprocess_shader: Option<&[u8]>
) -> Result<GlRenderContext<CF, DF>>
Creates a new Gfx GlRender context including the Gl Device. The default epoxy
Gl function pointer
will be used to load the Gl binding.
aa
antialiasing mode, currently supportedSingle
andMulti(4)
widget_width
width of the client area of the containing widgetwidget_height
height of the client area of the containing widget`postprocess_shader
optional buffer containing the source code of the postprocessing pixel shader. A simple default shader will be used ifNone
pub fn new_with_loader(
aa: AaMode,
widget_width: i32,
widget_height: i32,
get_proc_addr: &dyn Fn(&str) -> *const c_void,
postprocess_shader: Option<&[u8]>
) -> Result<GlRenderContext<CF, DF>>
[src]
aa: AaMode,
widget_width: i32,
widget_height: i32,
get_proc_addr: &dyn Fn(&str) -> *const c_void,
postprocess_shader: Option<&[u8]>
) -> Result<GlRenderContext<CF, DF>>
Creates a new Gfx GlRender context including the Gl Device.
aa
antialiasing mode, currently supportedSingle
andMulti(4)
widget_width
width of the client area of the containing widgetwidget_height
height of the client area of the containing widget`get_proc_addr
the function used to look up the Gl API function pointers (usuallyepoxy::get_proc_addr
)postprocess_shader
optional buffer containing the source code of the postprocessing pixel shader. A simple default shader will be used ifNone
pub fn gfx_context_mut(&mut self) -> &mut GlGfxContext
[src]
Returns a reference to the current Gfx context
pub fn viewport(&self) -> Viewport
[src]
Returns a copy of the current viewport
pub fn resize<R>(
&mut self,
widget_width: i32,
widget_height: i32,
render_callback: Option<&mut R>
) -> Result<()> where
R: GlRenderCallback<CF, DF>,
[src]
&mut self,
widget_width: i32,
widget_height: i32,
render_callback: Option<&mut R>
) -> Result<()> where
R: GlRenderCallback<CF, DF>,
Re-allocates render buffers and textures if the size has changed since last resize or creation of the context
widget_width
width of the client area of the containing widgetwidget_height
height of the client area of the containing widget`render_callback
ifSome(_)
, forwards the resize message to the given RenderCallbak for internal adjustment
pub fn with_gfx<R>(&mut self, render_callback: &mut R) where
R: GlRenderCallback<CF, DF> + GlPostprocessCallback<CF, DF>,
[src]
R: GlRenderCallback<CF, DF> + GlPostprocessCallback<CF, DF>,
Renders on the GlArea
by invoking the render
function to write onto the offline render target
and blit the result onto the actual GlArea
framebuffer, optionally applying an intermediate
postprocess
step (also customizable).
Also transparently takes care of Gl context and state changes.
render_callback
a reference of the render callback implementing the actual drawing