Part of the Khronos Group

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: Can OpenGL and WebGL share a set of bindings?

  1. #1
    Newbie Newbie
    Join Date
    Jun 2018

    Question 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?

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Jun 2013
    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).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts