Over a million developers have joined DZone.

Why WebGL is a 2D, Rather than a 3D, API

· Web Dev Zone

Make the transition to Node.js if you are a Java, PHP, Rails or .NET developer with these resources to help jumpstart your Node.js knowledge plus pick up some development tips.  Brought to you in partnership with IBM.

For those of you wanting to develop browser-based 3D graphics, WebGL may be the answer to your prayers.  WebGL enables developers to produce cool 3D images in a Web browser using Javascript, which can result in some pretty nifty effects.  In a recent blog post, Gregg Tavares explains what many people do not realize about WebGL: it is not a 3D API.  

WebGL is an API that extends Javascript to allow for the creation of 3D graphics in a web browser using Canvas.  In order to produce a 3D image, WebGL requires a programmer to provide inputs for image coordinates and image colors.  Tavares's blog details some simple examples of the results of inputting various shaders into WebGL.  He reveals that, no matter how you spin it, WebGL only accepts 2D position and color data.  In order to convert the image to 3D, it is up to the programmer to input the proper 3D shaders due to the 2D nature of WebGL.

In his follow-up post, Tavares delves into image processing by showing readers how to manipulate image colors and detail in WebGL.  He concludes on a positive note highlighting the user-friendliness of this API . . .

 I hope you can see that WebGL is actually a pretty simple API. While it can get more complicated to do 3D that complication is added by you, the programmer, in the form of more complex shaders. --Gregg Tavares

For some more resources on WebGL development, check out the Mozilla Developers Network

Source: http://games.greggman.com/game/webgl-fundamentals/

Learn why developers are gravitating towards Node and its ability to retain and leverage the skills of JavaScript developers and the ability to deliver projects faster than other languages can.  Brought to you in partnership with IBM.


Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}