Coder Social home page Coder Social logo

Support IEWebGL about seriously.js HOT 5 CLOSED

Xogede avatar Xogede commented on June 22, 2024
Support IEWebGL

from seriously.js.

Comments (5)

brianchirls avatar brianchirls commented on June 22, 2024

It looks like it wouldn't work as is. As far as I can tell, IEWebGL uses an <object> element in place of a canvas. Seriously.js requires "Target" nodes to be a <canvas> element. I suppose it's possible to use duck typing instead to allow an <object> element with a .getContextmethod, assuming everything else works the same as native WebGL.

As long as you're going to require users to install a plugin, why not just use Chrome Frame?

from seriously.js.

Xogede avatar Xogede commented on June 22, 2024

Thanks for the answer! I have a local application where the UI is done by embedding Internet Explorer 9. I chose IE because of the ease of communication using ActiveX, and also because it worked way smoother for my workloads than other browsers. Seriously.js, especially the hue-saturation filter, would greatly enhance its uses.
IEWebGL seems to have a setting that allows local video files to be played (http://iewebgl.com/Developer.aspx#SpecialSettings), allowing it to be used in such a context.

I could try to remove the canvas element checks myself in a local copy, but I figured it wouldn't hurt to ask about official IEWebGL support first.

from seriously.js.

brianchirls avatar brianchirls commented on June 22, 2024

Couldn't hurt to fork and create new branch.

Maybe try a polyfill on the canvas element that creates a new <object> element and a WebGLRenderingContext using the IEWebGL plugin. Something like...

(function() {
  var canvas = document.createElement('canvas');
  var gl = canvas.getContext('webgl') || canvas.getContext('experimental-webgl');
  if (gl) {
    return;
  }

  var originalGetContext = window.HTMLCanvasElement.prototype.getContext;

  window.HTMLCanvasElement.prototype.getContext = function(contextType) {
    if (contextType !== 'experimental-webgl' && contextType !== 'webgl') {
      return originalGetContext.call(this, contextType);
    }

    // <object style="width:100%;height:100%" id="glCanvas" type="application/x-webgl"></object>
    var element = document.createElement('object');
    element.setAttribute('type', 'application/x-webgl');
    element.setAttribute('width', this.width);
    element.setAttribute('height', this.height);
    //todo: position this object element on top of the canvas element.
    gl = element.getContext(contextType);
    return gl;
  };
}());

You'd have a lot of work to do to keep the object element in the right place, but this might help you use the existing code - in particular the unit tests, which will really help you make sure everything is working right. Many of the unit tests explicitly create a canvas element, and you'd have to rewrite them all to get them using an object instead.

from seriously.js.

brianchirls avatar brianchirls commented on June 22, 2024

It's probably worth reading an analogous thread on three.js where they tried the same thing.
mrdoob/three.js#2173

from seriously.js.

brianchirls avatar brianchirls commented on June 22, 2024

I'm going to close this for now, since there hasn't been activity in over a year. IE is on it's way to full WebGL support, and this is outside the scope of Seriously.js. I have added a new feature that allows for different source types to be defined as plugins. I may one day make targets pluggable as well, which might make something like this easier.

from seriously.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.