Using webgl on top of cesium

We use OpenGL directly to render electric utility facilities on top of NASA's Worldwind product with great success and were wondering if it is possible to use webgl directly to do the same with cesium?

With Cesium, there’s a few options for custom rendering. From most common (and easiest) to less common:

  • Create geometries for your data from Cesium’s large geometry collection (tutorial). This doesn’t require any WebGL.
  • Create custom geometries, basically vertex and index buffers, and appearances, basically shaders and render state (partial draft tutorial). Mix and match your own with Cesium’s collection. This can require writing GLSL shaders, but the other WebGL features are abstracted.
  • Implement a Cesium primitive, which has full access to the Cesium renderer - including vertex arrays, buffers, textures, render state, shader programs, framebuffers, etc. A simple example is the EllipsoidPrimitive.
    Even the last option above doesn’t use WebGL directly, except for writing GLSL shaders. Modern engines, including Cesium, abstract the graphics API, which makes it easier to use and generally faster since it allows the engine to centralize optimizations like minimizing GL state changes. Porting your OpenGL code to use the Cesium renderer should be pretty easy. If your case is simple enough, creating or using existing geometries and appearances will be the easiest approach.

If you can tell us more about how your currently using OpenGL, I can provide more concrete advice.


Hi Randy,

I’m actually in the COLLADA working group, and would recommend that you stream down glTF, instead of COLLADA, since glTF is designed with the web in mind:

You may be able to build directly on top of the glTF implementation in-progress in Cesium:!topic/cesium-dev/soK05NfUuM8

Or you could at least borrow bits of code from it if you need a more efficient implementation for batching together a large number of assets in view.