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§
Sourcefn init(config: &RenderConfig) -> OsmicResult<Self>where
Self: Sized,
fn init(config: &RenderConfig) -> OsmicResult<Self>where
Self: Sized,
Initialize the backend with the given configuration.
Sourcefn render(&mut self, scene: &SceneGraph) -> OsmicResult<()>
fn render(&mut self, scene: &SceneGraph) -> OsmicResult<()>
Render a scene graph to the internal buffer.
Sourcefn read_pixels(&self) -> Option<Vec<u8>>
fn read_pixels(&self) -> Option<Vec<u8>>
Read the rendered pixels as RGBA bytes.