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.