Cocos2d HTML5 gl.clearColor (glClearColor)

Just a quick note cos it took me bloody ages to find, but here’s the Cocos2d HTML5 (js) way of setting the GL clear color to something other than black. Originally on the iPhone I’d use glClearColor(), so the equivalent in JavaScript is:

var gl = cc.renderContext;
gl.clearColor(0.5, 0.4, 0.2, 0);

 

The parameters are R, G, B, and alpha as you’d expect.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>