Skip to content

Commit

Permalink
closes #965
Browse files Browse the repository at this point in the history
  • Loading branch information
Lauren McCarthy committed Oct 12, 2015
1 parent 95e85fa commit 08774d9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/core/rendering.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@ p5.prototype.createCanvas = function(w, h, renderer) {
else {
if (isDefault) {
c = document.createElement('canvas');
c.id = 'defaultCanvas';
var i = 0;
while (document.getElementById('defaultCanvas'+i)) {
i++;
}
c.id = 'defaultCanvas'+i;

This comment has been minimized.

Copy link
@ericsoco

ericsoco Oct 12, 2015

This seems fine, but do you think you should keep 'defaultCanvas' to avoid breaking existing sketches embedded in pages that rely on selecting #defaultCanvas explicitly?

} else { // resize the default canvas if new one is created
c = this.canvas;
}
Expand Down

5 comments on commit 08774d9

@indefinit
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @lmccart just tested commit #08774d9 in webgl and it's unfortunately a breaking change. Any chance we can roll back to commit #95e85fa in the meantime?

@lmccart
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahh I'm sorry, I thought I tested that! I just pushed a patch that should fix the issue and also addresses #998. do you want to give it a try?

@indefinit
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I'll take a stab. One thing I should note about multiple webgl instances on same page, this is known to be a tricky limitation in webgl in general. I don't think it's impossible but from what I recall THREE.js had some clever workarounds for multiple gl context on the same page. I'll first fix the breaking change and then tackle the gl instancing issue.

@lmccart
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I fixed both already, if you want to try the latest patch I pushed. we can disable multiple webgl instances though and print an error instead if you think it's a bad idea.

@indefinit
Copy link
Contributor

@indefinit indefinit commented on 08774d9 Oct 13, 2015 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.