hyperandroid / CAAT

Canvas Advanced Animation Toolkit
hyperandroid.github.com/CAAT
MIT License
727 stars 117 forks source link

WebGL example #101

Closed fracasula closed 11 years ago

fracasula commented 11 years ago

Hi, I've written a basic scenario with some wonderful circles. With canvas all works correctly, but if I try to replace the director.initialize() with director.initializeGL(), I receive the following errors and no data has been displayed:

WebGL: INVALID_VALUE: vertexAttribPointer: bad size, stride or offset
WebGL: INVALID_OPERATION: uniformMatrix4fv: location is not from current program

My code (commenting and uncommenting /var universe/ produce the same):

(function () {
    window.addEventListener(
        'load',
        function () {
            var director = new CAAT.Director().initializeGL(
                    800,
                    480
                ).setClear(!1),
                scene = director.createScene();

            /*var universe = new Universe(director, scene);
            universe.create();
            universe.populate();*/

            director.loop(60);
        },
        false);
})();

On the same browser, Chrome 23 on Ubuntu 12.10, Sumon WebGL runs, so WebGL with CAAT are supported by my environment.

So, is possible to read some "getting started" tutorial to have a basic webgl + caat app running? I see here: http://labs.hyperandroid.com/static/CAAT-Samples/tutorials/t1.html

Thanks in advance.

fracasula commented 11 years ago

Simple page with this code doesn't work:

(function () {
    window.addEventListener(
        'load',
        function () {
            var director = (new CAAT.Director).initializeGL(800, 480).setClear(!1),
                scene = director.createScene();

            scene.addChild(new CAAT.ShapeActor().
                setSize(40, 40).
                setPosition(50, 50).
                setLineWidth(2).
                setStrokeStyle('#1C1CA6').
                setFillStyle('#FFFF00'));

            director.loop(60);
        },
        false);
})();

Same errors:

WebGL: INVALID_VALUE: vertexAttribPointer: bad size, stride or offset
WebGL: INVALID_OPERATION: uniformMatrix4fv: location is not from current program

With canvas (no webgl) all works correctly...

fracasula commented 11 years ago

Fortunately the same code (webgl) runs on Chromium and on Samsung GS2 with CocoonJS. Poor performance, but run :)

arnuschky commented 10 years ago

We're having the same issue: WebGL under current CAAT does not seem to work (tested using latest Chrome Version 27.0.1453.110 under Linux). Can someone else confirm that?