The difference between canvas render and WebGL render in the Web

Source: Internet
Author: User

Canvas is a label that appears in the HTML5, and can only draw a two-dimensional diagram at the beginning, and later, we think of 3d, so we put JavaScript together with OpenGL, make a WebGL, this thing

is a drawing of the time, need to use, white to be webglcontext, holding this can draw 3d of things. Before the context, can only draw 2d of things

 <HTML><Head><Scriptsrc= "Jslib/webgl-utils.js"></Script><Scriptsrc= "Jslib/webgl-debug.js"></Script><Scriptsrc= "Jslib/cuon-utils.js"></Script><Script>functionMain () {varCanvas=document.getElementById ("MyCanvas");varGL=getwebglcontext (canvas);if(!GL) {Console.log ("Failed to get the rending contentxt for WebGL.");} Gl.clearcolor (1,0,0,1); Gl.clear (GL. color_buffer_bit);}</Script></Head><Bodyonload= "Main ()"><CanvasID= "MyCanvas"width=Height=>Hello</Canvas></Body></HTML>


Refer to this for an intuitive understanding of WebGL. The above JS reference file is available to download from here Http://files.cnblogs.com/files/terryc/jslib.zip

Http://www.cnblogs.com/mirror-pc/p/4181398.html

The difference between canvas render and WebGL render in the Web

Related Article

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.