Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.width and .height don't work with webgl-2d canvas ? #32

Open
BuzzBuzz opened this issue May 20, 2014 · 1 comment
Open

.width and .height don't work with webgl-2d canvas ? #32

BuzzBuzz opened this issue May 20, 2014 · 1 comment

Comments

@BuzzBuzz
Copy link

Hello
I am trying to use webgl-2d instead of my usual canvas but I get a size problem.
I define .width and .height for resolution and .style.width and .style.height for size on screen. But with webgl-2d, the canvas is small in the bottom left corner.
Is there a specific way to give webgl-2d canvas their size ?

@codeimpossible
Copy link

i know this is a really old issue, but for anyone else interested: calling viewport() after webgl2d is enabled with the new dimensions worked for me.

if (this.canvas.gl2d) {
  var gl2d = this.canvas.gl2d;
  var gl = gl2d.gl = gl2d.canvas.$getContext("experimental-webgl");
  gl.viewport(0, 0, this.canvas.width, this.canvas.height);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants