Does webGL have push / popMatrix?

Does webGL have push / popMatrix? and if not, how would I like to recreate them?

+6
source share
2 answers

No, WebGL is based on OpenGL ES 2.0, so there is no built-in matrix control or fixed function pipeline. Presentation layout and projection matrices should be fully controlled in your own code and passed to shaders during drawing. You really don't need a push and a pop matrix if you use a scene graph or some other similar scene control system. All you really need is a good matrix and vector math library.

If you are still using the push and pop matrix functions, you can simply use an array of matrices and write functions such as push and pop that simply store your current matrix in the array and push or open the index down.

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

+12
source

From what I see here and there , there is no built-in support, but you can easily build such a stack using an array.

0
source

Source: https://habr.com/ru/post/919163/


All Articles