← Back to team overview

leaningtech-dev team mailing list archive

[Bug 1273394] [NEW] Can not compile "A simple WebGL example"

 

Public bug reported:

Tried to run the A Simple WebGl example from this page
http://www.leaningtech.com/duetto/examples/ and failed to compile. By
simply compy-paste the code compiler reports that client::Document is
not a pointer; maybe you meant to use '.'? Next, after changing the code
to use document. instead document-> compiler complained that
HTMLCanvasElement does not refer to a value. I am not good with C++ but
to me it looks like the author wants to cast HTMLElement to
HTMLCanvasElement. So, after rewriting

auto canvas = document->getElementById
              <HTMLCanvasElement>("glcanvas"); 

to

auto canvas =
static_cast<HTMLCanvasElement*>(document.getElementById("glcanvas"));

I didn't receive this message again. Next, compiler complained with
WebGLRenderingContext  does  not refer  to a value so I rewrite this
line of code

auto gl = canvas->getContext
              <WebGLRenderingContext>("experimental-webgl");

to

auto gl = static_cast<WebGLRenderingContext*>(canvas->getContext
("experimental-webgl"));

but than he complained that he can not cast CanvasRenderingContext2D to
WebGLRenderingContext which is clear because canvas->getContext returns
type CanvasRenderingContext2D

Can you help me with this?

Thank you

** Affects: duetto
     Importance: Undecided
         Status: New


** Tags: sample webgl

-- 
You received this bug notification because you are a member of
Leaningtech Team, which is subscribed to Duetto.
https://bugs.launchpad.net/bugs/1273394

Title:
  Can not compile "A simple WebGL example"

Status in Duetto: C++ for the Web:
  New

Bug description:
  Tried to run the A Simple WebGl example from this page
  http://www.leaningtech.com/duetto/examples/ and failed to compile. By
  simply compy-paste the code compiler reports that client::Document is
  not a pointer; maybe you meant to use '.'? Next, after changing the
  code to use document. instead document-> compiler complained that
  HTMLCanvasElement does not refer to a value. I am not good with C++
  but to me it looks like the author wants to cast HTMLElement to
  HTMLCanvasElement. So, after rewriting

  auto canvas = document->getElementById
                <HTMLCanvasElement>("glcanvas"); 

  to

  auto canvas =
  static_cast<HTMLCanvasElement*>(document.getElementById("glcanvas"));

  I didn't receive this message again. Next, compiler complained with
  WebGLRenderingContext  does  not refer  to a value so I rewrite this
  line of code

  auto gl = canvas->getContext
                <WebGLRenderingContext>("experimental-webgl");

  to

  auto gl = static_cast<WebGLRenderingContext*>(canvas->getContext
  ("experimental-webgl"));

  but than he complained that he can not cast CanvasRenderingContext2D
  to WebGLRenderingContext which is clear because canvas->getContext
  returns type CanvasRenderingContext2D

  Can you help me with this?

  Thank you

To manage notifications about this bug go to:
https://bugs.launchpad.net/duetto/+bug/1273394/+subscriptions


Follow ups

References