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

setAttributes before GL canvas is made #3552

Merged
merged 8 commits into from Mar 11, 2019

Conversation

stalgiag
Copy link
Contributor

@stalgiag stalgiag commented Mar 1, 2019

This allows smooth, noSmooth and setAttributes to be called before a WEBGL canvas is made. WebGL drawing contexts require their attributes to be set at initialization and reinitialization is not desirable in some cases so this allows attributes to be set before the canvas is first created.

fixes #3061 & fixes #3180

@stalgiag
Copy link
Contributor Author

stalgiag commented Mar 1, 2019

A few things that aren't ideal:

storing the _glAttributes at the p5 level. Open to other ideas.

@Spongman and @sanketsingh24 please review

src/webgl/p5.RendererGL.js Outdated Show resolved Hide resolved
@stalgiag
Copy link
Contributor Author

stalgiag commented Mar 7, 2019

Now both the 2D and 3D renderer's modify and store the gl attributes in p5.instance._glAttributes. This way the attributes can be modified before making a WebGL canvas. Also, it is now possible to put calls to smooth() and setAttributes() in the draw loop as they will only actually do work and reinitialize context when there is an actual modification, repeated calls to assign the same setting will be ignored.

@stalgiag
Copy link
Contributor Author

stalgiag commented Mar 9, 2019

fixes #3356

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