webGL是否包含push/popMatrix? [英] Does webGL contain push/popMatrix?

查看:84
本文介绍了webGL是否包含push/popMatrix?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

webGL是否包含push/popMatrix?如果没有,我将如何重新创建它们?

Does webGL contain push/popMatrix? and if not, how would I go about recreating them?

推荐答案

否,WebGL基于OpenGL ES 2.0,因此没有内置的矩阵管理或固定功能管道.需要使用您自己的代码完全管理模型视图和投影矩阵,并在绘制时将其传递给着色器.如果您使用场景图或某种其他类似的场景管理系统,则实际上不需要推入式和弹出式矩阵.您真正需要的只是一个好的矩阵和矢量数学库.

No, WebGL is based off of OpenGL ES 2.0, so there is no built in matrix management or fixed function pipeline. The model view and projection matrices need to be completely managed in your own code and passed to shaders at draw time. You really don't need push and pop matrix if you are using a scene graph or some kind of other similar scene management system. All you really need is a good matrix and vector math library.

如果您仍设置使用推入式和弹出式矩阵,则可以简单地使用一个矩阵数组,并编写推入式和弹出式函数,这些函数只需将当前矩阵保存到该数组中并向下推或弹出索引即可.

If you are still set on using push and pop matrix, you could simply use an array of matrices, and write functions like push and pop that simply save your current matrix into the array and push or pop the index down.

如果在过渡到WebGL时需要更多帮助,我将获得OpenGL ES 2.0编程指南.该书的网站位于: http://opengles-book.com/包含一些源代码的下载链接.带有针对各种平台和语言(包括WebGL)的演示.如果需要,它还包含一个不错的数学库.

I would get the OpenGL ES 2.0 programming guide if you need more help with transitioning to WebGL. The book's website here: http://opengles-book.com/ contains a download link to some source code with demos for a variety of platforms and languages including WebGL. It also contains a decent math library if you need it.

这篇关于webGL是否包含push/popMatrix?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆