Skip to main content

RenderBackend

Trait RenderBackend 

Source
pub trait RenderBackend {
    // Required methods
    fn init(config: &RenderConfig) -> OsmicResult<Self>
       where Self: Sized;
    fn render(&mut self, scene: &SceneGraph) -> OsmicResult<()>;
    fn read_pixels(&self) -> Option<Vec<u8>>;
    fn resize(&mut self, width: u32, height: u32);
}
Expand description

Abstraction over rendering backends (software, GPU).

Required Methods§

Source

fn init(config: &RenderConfig) -> OsmicResult<Self>
where Self: Sized,

Initialize the backend with the given configuration.

Source

fn render(&mut self, scene: &SceneGraph) -> OsmicResult<()>

Render a scene graph to the internal buffer.

Source

fn read_pixels(&self) -> Option<Vec<u8>>

Read the rendered pixels as RGBA bytes.

Source

fn resize(&mut self, width: u32, height: u32)

Resize the render target.

Implementors§