Registry / other / piston2d-opengl-graphics

piston2d-opengl-graphics

JSON →
library0.89.0rscratesunverified

An OpenGL 2D backend for the Piston game engine, providing rendering capabilities.

# Cargo.toml [dependencies] piston2d-opengl_graphics = "0.89.0"
INSTALL
IMPORT
SIG · PISTON2D-OPENGL-GR
P
piston2d-opengl-graphics
otherrustv0.89.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

OpenGL
use opengl_graphics::OpenGL;

Sets up a Piston window with OpenGL 2D graphics backend and clears the screen.

use opengl_graphics::{OpenGL, GlGraphics}; use piston_window::*; fn main() { let mut window: PistonWindow = WindowSettings::new("Hello", [640, 480]) .graphics_api(OpenGL::V3_2) .exit_on_esc(true) .build() .unwrap(); let mut gl = GlGraphics::new(OpenGL::V3_2); while let Some(e) = window.next() { if let Some(args) = e.render_args() { gl.draw(args.viewport(), |c, g| { clear([1.0; 4], g); }); } } }
Debug
Known issues
gotchaRequires the `piston_window` crate for windowing; this crate alone is just the backend.
fix
Add `piston_window` to Cargo.toml and use it to create the window.
affects: >=0.80.0
Upgrade
Version history
0.89.0latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
piston2d-opengl-graphics — cargo add piston2d-opengl-graphics · libregistry