A brief analysis of differences between OpenGL ES directive in WebGL and C version instruction in IOS

Source: Internet
Author: User

A brief analysis of differences between OpenGL ES directive in WebGL and C version instruction in IOS

The beautiful Life of the Sun Vulcan (http://blog.csdn.net/opengl_es)

This article follows "Attribution-non-commercial use-consistent" authoring public agreement

Reprint Please keep this sentence: Sun Vulcan's Beautiful Life-this blog focuses on Agile development and mobile and IoT device research: IOS, Android, HTML5, Arduino, Pcduino , Otherwise, the article from this blog refused to reprint or re-reproduced, thank you for your cooperation.


The difference between the OpenGL ES directive in WebGL and the C directive in IOS is that, as a whole, it should be omitted from the GL prefix in the WebGL version of the directive, for example:

    Glenable (gl_cull_face);    Glfrontface (GL_CW);

    Gl.enable (GL. Cull_face);    Gl.frontface (GL. CW);

From the above example, it can be seen that the C version of the use of the global function, process-oriented usage, so there is no object;

In WebGL, a method encapsulated in an object is invoked in the form of a GL object (an instance of a WebGL object) to invoke the corresponding C-version of the package contained in a WebGL object, so omitting the GL prefix for the C-version directive is understandable.


As for the GL object, it is created as follows:

var gl;function initgl (Canvas) {    try {        gl = canvas.getcontext ("Experimental-webgl");        Gl.viewportwidth = Canvas.width;        Gl.viewportheight = canvas.height;    } catch (E) {    }    if (!GL) {        alert ("Could not initialise WebGL, sorry:-(");}    }

The canvas in the code above is a new label in HTML5, typically used to get a 2d context for drawing, and in the WebGL era, a new implementation has been added to support WebGL.

    var canvas = document.getElementById ("Lesson13-canvas");
<canvas id= "Lesson13-canvas" style= "Border:none;" width= "height=" ></canvas>

More differences, follow-up constantly found, and then at any time to add in.




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.