Skip to content

Safari WebGL is broken #198

@mseddon

Description

@mseddon

Unfortunately, while Firefox, IE, Edge, Chrome and Opera allow access to the GLenum constants on the WebGLRenderingContext constructor directly, this does not work on Safari (iOS or Desktop).

This leaves two options:

  • Move the constants defined in object WebGLRenderingContext onto class WebGLRenderingContext, which works, but personally I find pulling constants out of instance objects weird (especially since you might want to initialize a data structure with a GL constant before context initialization), or
  • Make object WebGLRenderingContext a non-native object containing the literals as final val (which are the same across all browsers, and the C OpenGL apis where applicable) - This is confirmed to work in principle, since I have a library that does this which I've been using well for several months, and I only now just noticed this issue when migrating to pure scala-js-dom. I prefer this solution, which appears to work, although it's tedious and error prone so some care must be taken (though I have what I believe to be a fairly correct implementation of such an object already, modulo some WebGL specific constants).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions