{"id":15939,"date":"2017-02-01T16:15:15","date_gmt":"2017-02-01T14:15:15","guid":{"rendered":"http:\/\/www.webcodegeeks.com\/?p=15939"},"modified":"2017-12-19T13:28:35","modified_gmt":"2017-12-19T11:28:35","slug":"html5-3d-tutorial","status":"publish","type":"post","link":"https:\/\/www.webcodegeeks.com\/html5\/html5-3d-tutorial\/","title":{"rendered":"HTML5 3D Tutorial"},"content":{"rendered":"<p>In this example we are going to learn about HTML5 canvas 3D API. Canvas was added to HTML in HTML5. HTML5 canvas is a powerful tool (or container) that is used for drawing images and shapes.<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n[ulp id=&#8217;tgm4cmEWcKUikZNn&#8217;]<br \/>\n&nbsp;<br \/>\nFor this example we will use:<\/p>\n<ul>\n<li>A computer with a modern browser installed<\/li>\n<li>notepad++<\/li>\n<\/ul>\n<h2>1. Getting Started<\/h2>\n<p>In the early days of HTML, 3d in the browser was sort of a myth. Displaying 3d in the browser was difficult or outrightly impossible. Today 3d in the browser is possible with WebGL. WebGL is the standard 3D graphics API for the web. WebGL works with the device hardware to render 3d graphics. WebGL works on modern desktops browsers as well as a growing number of hand held devices.\u00a0WebGL is an API based on opengl, and it accessed through JavaScript. WebGL works with HTML5 canvas (in browsers that support it) to render 3d graphics (without the use of plugins)<\/p>\n<h3>1.1 HTML5 Canvas<\/h3>\n<p>HTML5 canvas combined with JavaScript is used to do a lot of things, from drawing, setting transparency levels on images to even animations and game development. An HTML canvas is a rectangular area on the web page. By default, a canvas has no border and it also has no content.<\/p>\n<pre class=\"brush:bash\">&lt;canvas&gt;\r\n\r\n&lt;\/canvas&gt;\r\n<\/pre>\n<p>You can create an HTML5 canvas by using the tag above. You can also set the width and height of the canvas within its tag or you can do it with JavaScript. Lets look at the example below:<\/p>\n<pre class=\"brush:bash\">&lt;canvas width=500 height=500 &gt;\r\n\r\n&lt;\/canvas&gt;\r\n<\/pre>\n<p>To set the width and height through JavaScript we have to set an ID on our tag.<\/p>\n<pre class=\"brush:bash\">&lt;canvas\u00a0id=board &gt;\r\n\r\n&lt;\/canvas&gt;\r\n<\/pre>\n<p>It is also possible to create HTML5 canvas element on the fly with JavaScript<code>document.createElement()\u00a0<\/code>.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>index.html<\/em><\/span><\/p>\n<pre class=\"brush:html\">&lt;!DOCTYPE html&gt; \r\n&lt;html lang=en&gt;\r\n\t&lt;head&gt;\r\n\t&lt;style&gt;\r\n\thtml, body{\r\n\twidth:100%;\r\n\theight:100%;\r\n\tmargin:0%;\r\n\tfont-family:\"helvetica\",\"verdana\",\"calibri\", \"san serif\";\r\n\toverflow:hidden;\r\n\tpadding:0%;\r\n\tborder:0%;\r\n\t}\r\n\t \r\n\t&lt;\/style&gt;\r\n\t \t\t&lt;meta charset=\"utf-8\" \/&gt;\r\n\t\t&lt;meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, target-densitydpi=device-dpi\"\/&gt;\r\n\t\r\n\t&lt;title&gt;HTML5 canvas test&lt;\/title&gt;\r\n\t\r\n\t&lt;\/head&gt;\r\n\t&lt;body onload=init()&gt;\r\n&lt;script&gt;\r\n\/\/function called when page load is finished\r\nfunction init(){\r\nvar canvas=document.getElementById(\"board\");\/\/ get the canvas element\r\ncanvas.width=document.body.clientWidth;\/\/set the width of the canvas to the body of the page\r\ncanvas.height=document.body.clientHeight;\/\/set the height of the canvas to the body of the page\r\n\r\n\r\n}\r\n\r\n&lt;\/script&gt;\r\n\t\r\n\t&lt;canvas id=board&gt;\r\n\t\r\n\t&lt;\/canvas&gt;\r\n\r\n\t&lt;\/body&gt;\r\n\t&lt;\/html&gt;\r\n\r\n<\/pre>\n<h3>1.2 Rendering 3D<\/h3>\n<p>To render 3d With WebGL, we first need to create or get access to a canvas. Let&#8217;s see how to do that in the code fragment below:<\/p>\n<pre class=\"brush:bash\"> \r\n&lt;canvas id=\"boarf\" width=\"640\" height=\"480\"&gt;\r\n &lt;\/canvas&gt;\r\n\r\n<\/pre>\n<p>Below is the JavaScript code that registers an event listener.<\/p>\n<pre class=\"brush:bash\">window.addEventListener(\"load\",init);\/\/ register an eventlistener for web page onload\r\n<\/pre>\n<p>In the code fragment above we successfully created our canvas. The init function is called after the page is loaded it simply initializes WebGL. Lets see another code fragment below<\/p>\n<pre class=\"brush:bash\">gl = null; \/\/set variable to null\r\n\/\/ Try initialize the WebGL context. If it fails, try the to experimental. \r\ngl =canvas.getContext('webgl') || canvas.getContext('experimental-webgl'); \r\n\r\n<\/pre>\n<p>Let&#8217;s look at a full example below:<\/p>\n<p><span style=\"text-decoration: underline;\"><em>index2.html<\/em><\/span><\/p>\n<pre class=\"brush:html\">&lt;!DOCTYPE html&gt; \r\n&lt;html lang=en&gt;\r\n\t&lt;head&gt;\r\n\t&lt;style&gt;\r\n\thtml, body{\r\n\twidth:100%;\r\n\theight:100%;\r\n\tmargin:0%;\r\n\tfont-family:\"helvetica\",\"verdana\",\"calibri\", \"san serif\";\r\n\toverflow:hidden;\r\n\tpadding:0%;\r\n\tborder:0%;\r\n\t}\r\n\t \r\n\t&lt;\/style&gt;\r\n\t \t\t&lt;meta charset=\"utf-8\" \/&gt;\r\n\t\t&lt;meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, target-densitydpi=device-dpi\"\/&gt;\r\n\t\r\n\t&lt;title&gt;HTML5 canvas test&lt;\/title&gt;\r\n\t\r\n\t&lt;\/head&gt;\r\n\t&lt;body onload=init()&gt;\r\n&lt;script&gt;\r\n\/\/function called when page load is finished\r\nfunction init(){\r\nvar canvas=document.getElementById(\"board\");\/\/ get the canvas element\r\ncanvas.width=document.body.clientWidth;\/\/set the width of the canvas to the body of the page\r\ncanvas.height=document.body.clientHeight;\/\/set the height of the canvas to the body of the page\r\n\r\n \/\/ Initialize the GL context\r\n gl = getWebGL(canvas); \/\/ Only continue if WebGL is available and working \r\nif (!gl) { \r\nreturn; \r\n} \/\/ Set clear color to black, fully opaque\r\n gl.clearColor(0.0, 0.0, 0.0, 1.0); \/\/ Enable depth testing\r\n gl.enable(gl.DEPTH_TEST); \/\/ Near things obscure far things\r\n gl.depthFunc(gl.LEQUAL); \/\/ Clear the color as well as the depth buffer.\r\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); \r\n}\r\nfunction getWebGL(canvas) {\r\n gl = null; \/\/set variable to null\r\n\/\/ Try initialize the WebGL context. If it fails, try the to experimental. \r\ngl =canvas.getContext('webgl') || canvas.getContext('experimental-webgl'); \r\n\/\/ if we couldnt get a GL context, alert the user about the error\r\n if (!gl) { \r\nalert(\"We could not initialize WebGL. You might need to update your browser or upgrade your device hardware\"); \r\n} \r\nreturn gl;\r\n }\r\n&lt;\/script&gt;\r\n\t\r\n\t&lt;canvas id=board&gt;\r\n\t\r\n\t&lt;\/canvas&gt;\r\n\r\n\t&lt;\/body&gt;\r\n\t&lt;\/html&gt;\r\n\r\n<\/pre>\n<p>In the code above we initialize the canvas and try to get a 3d context, if we are successful we store the context in a variable or else we alert the user about the error. It is possible for the user to be running an out dated browser on their desktop computer or mobile device. The user can also be using a hardware that doesn&#8217;t support OpenGL (WebGL is based on OpenGl).<br \/>\nWe have successfully created our WebGL context, lets draw with it.<\/p>\n<figure id=\"attachment_15955\" aria-describedby=\"caption-attachment-15955\" style=\"width: 860px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/01\/pic.png\"><img decoding=\"async\" class=\"wp-image-15955 size-full\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/01\/pic.png\" width=\"860\" height=\"484\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/01\/pic.png 860w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/01\/pic-300x169.png 300w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/01\/pic-768x432.png 768w\" sizes=\"(max-width: 860px) 100vw, 860px\" \/><\/a><figcaption id=\"caption-attachment-15955\" class=\"wp-caption-text\">Fig 1: WebGL Context<\/figcaption><\/figure>\n<p><span style=\"text-decoration: underline;\"><em>index3.html<\/em><\/span><\/p>\n<pre class=\"brush:html\">&lt;!DOCTYPE html&gt; \r\n&lt;html lang=en&gt;\r\n\t&lt;head&gt;\r\n\t&lt;style&gt;\r\n\thtml, body{\r\n\twidth:100%;\r\n\theight:100%;\r\n\tmargin:0%;\r\n\tfont-family:\"helvetica\",\"verdana\",\"calibri\", \"san serif\";\r\n\toverflow:hidden;\r\n\tpadding:0%;\r\n\tborder:0%;\r\n\t}\r\n\t \r\n\t&lt;\/style&gt;\r\n\t \t\t&lt;meta charset=\"utf-8\" \/&gt;\r\n\t\t&lt;meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, target-densitydpi=device-dpi\"\/&gt;\r\n\t\r\n\t&lt;title&gt;HTML5 canvas test&lt;\/title&gt;\r\n\t\r\n\t&lt;\/head&gt;\r\n\t&lt;body onload=init()&gt;\r\n&lt;script&gt;\r\n\/\/function called when page load is finished\r\nfunction init(){\r\n canvas=document.getElementById(\"board\");\/\/ get the canvas element\r\ncanvas.width=document.body.clientWidth;\/\/set the width of the canvas to the body of the page\r\ncanvas.height=document.body.clientHeight;\/\/set the height of the canvas to the body of the page\r\n\r\n \/\/ Initialize the GL context\r\n gl = getWebGL(canvas); \/\/ Only continue if WebGL is available and working \r\nif (!gl) { \r\nreturn; \r\n} \/\/ Set clear color to black, fully opaque\r\n gl.clearColor(0.0, 0.0, 0.0, 1.0); \/\/ Enable depth testing\r\n gl.enable(gl.DEPTH_TEST); \/\/ Near things obscure far things\r\n gl.depthFunc(gl.LEQUAL); \/\/ Clear the color as well as the depth buffer.\r\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); \r\ndraw();\r\n}\r\n\r\nfunction getWebGL(canvas) {\r\n gl = null; \/\/set variable to null\r\n\/\/ Try initialize the WebGL context. If it fails, try the to experimental. \r\ngl =canvas.getContext('webgl') || canvas.getContext('experimental-webgl'); \r\n\/\/ if we couldnt get a GL context, alert the user about the error\r\n if (!gl) { \r\nalert(\"We could not initialize WebGL. You might need to update your browser or upgrade your device hardware\"); \r\n} \r\nreturn gl;\r\n }\r\nfunction draw(){\/*\r\n \/*  Define the geometry and store it in buffer objects *\/ \r\n\r\n\/\/Vertices are the points in 3D space that define the shapes we\u2019re drawing\r\nvar vertices = [-0.5, 0.5, -0.5, -0.5, 0.0, -0.5,]; \r\n\/\/ Create a new buffer object \r\n\r\nvar vertex_buffer = gl.createBuffer(); \r\n\r\n\/\/ this line tells WebGL that any following operations that act on buffers should use the one we specify, buffers are things that hold the details of the the triangle and the square that we\u2019re going to be drawing\u00a0\r\n gl.bindBuffer(gl.ARRAY_BUFFER, vertex_buffer); \r\n\/\/ We pass the vertices data into the buffer, with a float32Array using our JavaScript list\r\n gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertices), gl.STATIC_DRAW);\r\n\r\n\/\/ we can now unbind the buffer\r\n gl.bindBuffer(gl.ARRAY_BUFFER, null); \r\n\r\n \/\/ Vertex shader source code\r\n var vertCode = 'attribute vec2 coordinates;' + 'void main(void) {' + ' gl_Position = vec4(coordinates,0.0, 1.0);' + '}'; \r\n\/\/Create a vertex shader object \r\nvar vertShader = gl.createShader(gl.VERTEX_SHADER); \r\n\/\/Attach vertex shader source code\r\n gl.shaderSource(vertShader, vertCode); \r\n\/\/Compile the vertex shader\r\n gl.compileShader(vertShader);\r\n \/\/Fragment shader source code \r\nvar fragCode = 'void main(void) {' + 'gl_FragColor = vec4(0.0, 0.0, 0.0, 0.1);' + '}'; \r\n\/\/ Create fragment shader object\r\n var fragShader = gl.createShader(gl.FRAGMENT_SHADER); \r\n\/\/ Attach fragment shader source code\r\n gl.shaderSource(fragShader, fragCode);\r\n \/\/ Compile the fragment shader \r\ngl.compileShader(fragShader); \r\n\/\/ Create a shader program object to store combined shader program\r\n var shaderProgram = gl.createProgram(); \r\n\/\/ Attach a vertex shader\r\n gl.attachShader(shaderProgram, vertShader); \r\n\/\/ Attach a fragment shader\r\n gl.attachShader(shaderProgram, fragShader); \r\n\/\/ Link both programs\r\n gl.linkProgram(shaderProgram); \/\/ Use the combined shader program object\r\n gl.useProgram(shaderProgram);\r\n\r\n\/\/Bind vertex buffer object \r\ngl.bindBuffer(gl.ARRAY_BUFFER, vertex_buffer); \r\n\/\/Get the attribute location \r\nvar coord = gl.getAttribLocation(shaderProgram, \"coordinates\"); \r\n\/\/point an attribute to the currently bound VBO \r\ngl.vertexAttribPointer(coord, 2, gl.FLOAT, false, 0, 0); \r\n\/\/Enable the attribute\r\n gl.enableVertexAttribArray(coord); \r\n \r\n\/\/ Clear the canvas and set the color to black\r\n gl.clearColor(0.0, 0.0, 0.0,1.0); \r\n\/\/ Enable the depth test so that things drawn behind should be hidden by things drawn in front\r\n gl.enable(gl.DEPTH_TEST); \r\n\/\/ Clear the color buffer bit \r\ngl.clear(gl.COLOR_BUFFER_BIT);\r\n \/\/ Set the view port, this tells WebGL about the size of the canvas \r\ngl.viewport(0,0,canvas.width,canvas.height); \r\n\/\/ Draw the triangle\r\n gl.drawArrays(gl.TRIANGLES, 0, 3); \r\n\r\n\r\n}\r\n\r\n\r\n&lt;\/script&gt;\r\n\t\r\n\t&lt;canvas id=board&gt;\r\n\t\r\n\t&lt;\/canvas&gt;\r\n\r\n\t&lt;\/body&gt;\r\n\t&lt;\/html&gt;\r\n<\/pre>\n<p>We draw a triangle on our canvas. The code has comments at each step which explains everything we have done.<\/p>\n<h2>2. Summary<\/h2>\n<p>In this example we learnt about 3d in the browser. We also learnt about WebGL, vertices, shaders and how to use them to draw a triangle on a canvas with a WebGL context.<\/p>\n<h2>3. Download the source code<\/h2>\n<div class=\"download\">\n<p><strong>Download<\/strong><br \/>\nYou can download the full source code of this example here:\u00a0<strong><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/01\/html53dcanvastutorial.zip\">html53dcanvastutorial<\/a><\/strong><\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>In this example we are going to learn about HTML5 canvas 3D API. Canvas was added to HTML in HTML5. HTML5 canvas is a powerful tool (or container) that is used for drawing images and shapes. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [ulp id=&#8217;tgm4cmEWcKUikZNn&#8217;] &nbsp; For this example we will use: &hellip;<\/p>\n","protected":false},"author":164,"featured_media":914,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[431],"class_list":["post-15939","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-html5","tag-webgl"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>HTML5 3D Tutorial - Web Code Geeks - 2026<\/title>\n<meta name=\"description\" content=\"In this example we are going to learn about HTML5 canvas 3D API. Canvas was added to HTML in HTML5. HTML5 canvas is a powerful tool (or container) that is\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.webcodegeeks.com\/html5\/html5-3d-tutorial\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"HTML5 3D Tutorial - Web Code Geeks - 2026\" \/>\n<meta property=\"og:description\" content=\"In this example we are going to learn about HTML5 canvas 3D API. Canvas was added to HTML in HTML5. HTML5 canvas is a powerful tool (or container) that is\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.webcodegeeks.com\/html5\/html5-3d-tutorial\/\" \/>\n<meta property=\"og:site_name\" content=\"Web Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webcodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2017-02-01T14:15:15+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-12-19T11:28:35+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/html5-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Olayemi Odunayo\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webcodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@webcodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Olayemi Odunayo\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.webcodegeeks.com\/html5\/html5-3d-tutorial\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/html5\/html5-3d-tutorial\/\"},\"author\":{\"name\":\"Olayemi Odunayo\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/417918d9b5811210265e8590509718b8\"},\"headline\":\"HTML5 3D Tutorial\",\"datePublished\":\"2017-02-01T14:15:15+00:00\",\"dateModified\":\"2017-12-19T11:28:35+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/html5\/html5-3d-tutorial\/\"},\"wordCount\":542,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/html5\/html5-3d-tutorial\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/html5-logo.jpg\",\"keywords\":[\"WebGL\"],\"articleSection\":[\"HTML5\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.webcodegeeks.com\/html5\/html5-3d-tutorial\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.webcodegeeks.com\/html5\/html5-3d-tutorial\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/html5\/html5-3d-tutorial\/\",\"name\":\"HTML5 3D Tutorial - Web Code Geeks - 2026\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/html5\/html5-3d-tutorial\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/html5\/html5-3d-tutorial\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/html5-logo.jpg\",\"datePublished\":\"2017-02-01T14:15:15+00:00\",\"dateModified\":\"2017-12-19T11:28:35+00:00\",\"description\":\"In this example we are going to learn about HTML5 canvas 3D API. Canvas was added to HTML in HTML5. HTML5 canvas is a powerful tool (or container) that is\",\"breadcrumb\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/html5\/html5-3d-tutorial\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.webcodegeeks.com\/html5\/html5-3d-tutorial\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/html5\/html5-3d-tutorial\/#primaryimage\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/html5-logo.jpg\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/html5-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.webcodegeeks.com\/html5\/html5-3d-tutorial\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.webcodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"HTML5\",\"item\":\"https:\/\/www.webcodegeeks.com\/category\/html5\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"HTML5 3D Tutorial\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"name\":\"Web Code Geeks\",\"description\":\"Web Developers Resource Center\",\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.webcodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webcodegeeks\",\"https:\/\/x.com\/webcodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/417918d9b5811210265e8590509718b8\",\"name\":\"Olayemi Odunayo\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/016b2a353262962fceecf5c274161cd9ef60fdf1593ec95e71d37f5fd9b444f6?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/016b2a353262962fceecf5c274161cd9ef60fdf1593ec95e71d37f5fd9b444f6?s=96&d=mm&r=g\",\"caption\":\"Olayemi Odunayo\"},\"description\":\"I am a programmer and web developer, who has experience in developing websites and writing desktop and mobile applications. I have worked with both schematic and schemaless databases. I am also familiar with third party API and working with cloud servers. I do programming on the client side with Java, JavaScript, html, Ajax and CSS while I use PHP for server side programming.\",\"sameAs\":[\"https:\/\/www.webcodegeeks.com\/\"],\"url\":\"https:\/\/www.webcodegeeks.com\/author\/olayemi-odunayo\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"HTML5 3D Tutorial - Web Code Geeks - 2026","description":"In this example we are going to learn about HTML5 canvas 3D API. Canvas was added to HTML in HTML5. HTML5 canvas is a powerful tool (or container) that is","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.webcodegeeks.com\/html5\/html5-3d-tutorial\/","og_locale":"en_US","og_type":"article","og_title":"HTML5 3D Tutorial - Web Code Geeks - 2026","og_description":"In this example we are going to learn about HTML5 canvas 3D API. Canvas was added to HTML in HTML5. HTML5 canvas is a powerful tool (or container) that is","og_url":"https:\/\/www.webcodegeeks.com\/html5\/html5-3d-tutorial\/","og_site_name":"Web Code Geeks","article_publisher":"https:\/\/www.facebook.com\/webcodegeeks","article_published_time":"2017-02-01T14:15:15+00:00","article_modified_time":"2017-12-19T11:28:35+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/html5-logo.jpg","type":"image\/jpeg"}],"author":"Olayemi Odunayo","twitter_card":"summary_large_image","twitter_creator":"@webcodegeeks","twitter_site":"@webcodegeeks","twitter_misc":{"Written by":"Olayemi Odunayo","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.webcodegeeks.com\/html5\/html5-3d-tutorial\/#article","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/html5\/html5-3d-tutorial\/"},"author":{"name":"Olayemi Odunayo","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/417918d9b5811210265e8590509718b8"},"headline":"HTML5 3D Tutorial","datePublished":"2017-02-01T14:15:15+00:00","dateModified":"2017-12-19T11:28:35+00:00","mainEntityOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/html5\/html5-3d-tutorial\/"},"wordCount":542,"commentCount":0,"publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/html5\/html5-3d-tutorial\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/html5-logo.jpg","keywords":["WebGL"],"articleSection":["HTML5"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.webcodegeeks.com\/html5\/html5-3d-tutorial\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.webcodegeeks.com\/html5\/html5-3d-tutorial\/","url":"https:\/\/www.webcodegeeks.com\/html5\/html5-3d-tutorial\/","name":"HTML5 3D Tutorial - Web Code Geeks - 2026","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/html5\/html5-3d-tutorial\/#primaryimage"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/html5\/html5-3d-tutorial\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/html5-logo.jpg","datePublished":"2017-02-01T14:15:15+00:00","dateModified":"2017-12-19T11:28:35+00:00","description":"In this example we are going to learn about HTML5 canvas 3D API. Canvas was added to HTML in HTML5. HTML5 canvas is a powerful tool (or container) that is","breadcrumb":{"@id":"https:\/\/www.webcodegeeks.com\/html5\/html5-3d-tutorial\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.webcodegeeks.com\/html5\/html5-3d-tutorial\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/html5\/html5-3d-tutorial\/#primaryimage","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/html5-logo.jpg","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/html5-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.webcodegeeks.com\/html5\/html5-3d-tutorial\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.webcodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"HTML5","item":"https:\/\/www.webcodegeeks.com\/category\/html5\/"},{"@type":"ListItem","position":3,"name":"HTML5 3D Tutorial"}]},{"@type":"WebSite","@id":"https:\/\/www.webcodegeeks.com\/#website","url":"https:\/\/www.webcodegeeks.com\/","name":"Web Code Geeks","description":"Web Developers Resource Center","publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.webcodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.webcodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.webcodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webcodegeeks","https:\/\/x.com\/webcodegeeks"]},{"@type":"Person","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/417918d9b5811210265e8590509718b8","name":"Olayemi Odunayo","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/016b2a353262962fceecf5c274161cd9ef60fdf1593ec95e71d37f5fd9b444f6?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/016b2a353262962fceecf5c274161cd9ef60fdf1593ec95e71d37f5fd9b444f6?s=96&d=mm&r=g","caption":"Olayemi Odunayo"},"description":"I am a programmer and web developer, who has experience in developing websites and writing desktop and mobile applications. I have worked with both schematic and schemaless databases. I am also familiar with third party API and working with cloud servers. I do programming on the client side with Java, JavaScript, html, Ajax and CSS while I use PHP for server side programming.","sameAs":["https:\/\/www.webcodegeeks.com\/"],"url":"https:\/\/www.webcodegeeks.com\/author\/olayemi-odunayo\/"}]}},"_links":{"self":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/15939","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/users\/164"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/comments?post=15939"}],"version-history":[{"count":0,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/15939\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media\/914"}],"wp:attachment":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media?parent=15939"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/categories?post=15939"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/tags?post=15939"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}