How can I use WebGL to create a tile-based multi-layer scrolling platform game?

Posted by Nicholas Hill on Game Development See other posts from Game Development or by Nicholas Hill
Published on 2012-09-04T21:42:40Z Indexed on 2012/09/05 3:50 UTC
Read the original article Hit count: 246

Filed under:
|

I've found WebGL (based on OpenGL) to be a fiendish and unforgiving framework for those learning to write HTML5-based games. Despite the presence of many examples on how to get started, I'm really struggling to understand how I could simply load a bunch of images and render them to a canvas quickly using WebGL.

My specific scenario involves trying to render a map using a bespoke but simple multi-layered tile engine, where each value in a three dimensional array points to the image to use for that location in the rendered image. Think "Sonic the Hedgehog" via tilesets, tiles, maps, layers, sprites etc.

Can anyone enlighten me:

1) How can I load an image that I can use as a texture in WebGL?

2) How can I dynamically select an image at run time and draw it at any co-ordinate, that I also select at run time?

© Game Development or respective owner

Related posts about html5

Related posts about webgl