Can OpenGL and WebGL share a set of bindings?

[Originally posten on Stackoverflow, where it was put on hold because it asks for opinions instead of facts]

I’m thinking about utilizing Scala’s multi platform capabilities (JVM, JS, Native) to write a generic ‘GL’ library which would work in any context with only minor differences.

Basically, I’d like to provide a number of Interfaces (Traits) with concrete hidden bindings for each platform. Native can obviously access OpenGL directly. Java has JOGL which pretty much directly maps to OpenGL, so that should work. However, ScalaJS only has access to WebGL. I found this page which lists the differences, however nothing seems like it couldn’t be overcome or abstracted away. Obviously WebGL is based upon OpenGL ES 2.0, so I would only provide abstract bindings for that specfic subset.

So, in order to abstract away the differences I need to know how similar the OpenGL and WebGL APIs are, but I only have very basic experience in WebGL.

TL;DR: How similar are the OpenGL and WebGL APIs and do you think it would be possible to write an abstract but still low level layer above them?

WebGL is basically JavaScript/DOM bindings for OpenGL ES 2.0. Other than that, the differences relate to integration with the DOM (e.g. the ability to use image, video and canvas objects as sources of pixel data for glTexImage2D() etc, security-related issues).