WebGL recursive processing and moving? rotation? zoom

Source: Internet
Author: User

There are only three modes of movement in the 3D World: move, rotate, zoom out.

The use of the settimeout function can be used to achieve repeated cyclic processing, then what is the specific approach?
The first argument to the SetTimeout function is the function that is called, and the second parameter is how long it takes (milliseconds) to call this function. If the first parameter is specified as the function that is currently running, then a continuous loop can be implemented.
? function A is called
? In function A, use settimeout and pass in function A as a parameter
After the specified time, function A is called
By following the steps above, the drawing portion of WebGL is written as a recursive function, which can be continuously cycled.

The function's internal invocation of the function itself, can be directly written to the name of the function, but if it is an anonymous function, this approach will not work.
The solution is to use the arguments and Callee attributes to invoke the function itself. The arguments object is generated automatically when a function is called, and the callee property is a reference to the function itself, and even an anonymous function can be recursive if used in this way.
This recursion is done using the Settimeout+arguments.callee combination described here.

WebGL recursive processing and moving? rotation? zoom

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.