How do I set the attributes of a WebGL context after it has been created?

雨燕双飞 提交于 2019-12-25 11:34:35

问题


I know that we can specify attributes for a WebGL context when we create the context:

var ctx = myCanvas.getContext(‘webgl’, attributes);

Is there a method that we can call to set the attributes of ctx after ctx has been created? For instance, can we do something akin to

var ctx = myCanvas.getContext(‘webgl’);
ctx.setAttributes(attributes);

回答1:


That would require being able to change the attributes of a context. Which you're not allowed to do. They're fixed at context creation time.




回答2:


here it is:context.getContextAttributes()



来源:https://stackoverflow.com/questions/17153833/how-do-i-set-the-attributes-of-a-webgl-context-after-it-has-been-created

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!