develop wherever and whenever you want...
Docs > GLView Class Reference

GLView Class Reference

Summary 
GLView objects are views that are created from a root view using createGlView(). The GLView acts as a container for WebGL. The only method on the view (in addition to common view methods) is to get the WebGL context object.

WebGLContext getContext()

Example 
root = new View(); glv = root.createGlView(root.width, root.height); 
gl = glv.getContext(); 
gl.start(); 
gl.clearColor(0.6,0.2,0.2,1); 
gl.clear(gl.COLORBUFFERBIT); 
gl.flush(); 
document.wait();


getContext 
Return a WebGL context object which can be used to render 3D content to the GLView.

WebGLContext getContext()

Parameters 
none

Return Value 
WebGL context object

Notes 
WebGL context operations are run on the background script thread to ensure that input and all Cocoa views are unblocked during lengthy WebGL render operations.