summaryrefslogtreecommitdiff
path: root/webhogg/wasm/src/context
diff options
context:
space:
mode:
authornatrixaeria <janng@gmx.de>2019-06-13 03:21:53 +0200
committernatrixaeria <janng@gmx.de>2019-06-13 03:21:53 +0200
commit7884252333cc102a8144e4eafc36f9ef605b1be7 (patch)
tree622630a07c6439a8970178548e20966320cc4fb1 /webhogg/wasm/src/context
parent5de862b4d175578ed67e177d482ac31bf811d486 (diff)
Draw violet background
Diffstat (limited to 'webhogg/wasm/src/context')
-rw-r--r--webhogg/wasm/src/context/graphics.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/webhogg/wasm/src/context/graphics.rs b/webhogg/wasm/src/context/graphics.rs
index 3476e5d..853e1e1 100644
--- a/webhogg/wasm/src/context/graphics.rs
+++ b/webhogg/wasm/src/context/graphics.rs
@@ -8,6 +8,12 @@ pub struct GraphicsContext {
impl GraphicsContext {
pub fn from_canvas(canvas: web_sys::OffscreenCanvas) -> Result<Self, WasmError> {
+ /*debug!("canvas object usw.: {:?}", canvas);
+ let canvas: web_sys::OffscreenCanvas = js_sys::Reflect::get(&canvas,
+ &wasm_bindgen::JsValue::from_str("canvas"))
+ .map_err(|_| WasmError::WebGl2ContextCreation(
+ format!("canvas object is not defined")))?
+ .into();*/
let context = canvas.get_context("webgl2")
.map_err(|_| WasmError::WebGl2ContextCreation(
format!("context cration failed: getContext returned an exception")))?
@@ -18,8 +24,8 @@ impl GraphicsContext {
.map_err(|_| WasmError::WebGl2ContextCreation(
format!("context object is not a context")))?;
- //context.clear(Gl::COLOR_BUFFER_BIT);
- //context.clear_color(0.6, 0.0, 0.6, 1.0);
+ context.clear_color(0.6, 0.0, 0.6, 1.0);
+ context.clear(Gl::COLOR_BUFFER_BIT);
Ok(Self {
})