kripken / box2d.js

Port of Box2D to JavaScript using Emscripten
1.32k stars 198 forks source link

Uncaught "Finished up all reserved function pointers." #25

Closed Joncom closed 11 years ago

Joncom commented 11 years ago

Error message: "Uncaught Finished up all reserved function pointers. Use a higher value for RESERVED_FUNCTION_POINTERS."

This occurs when calling the following function:

function getCanvasDebugDraw() {
    var debugDraw = new Box2D.b2Draw();

    Box2D.customizeVTable(debugDraw, [{
    original: Box2D.b2Draw.prototype.DrawSegment,
    replacement:
        function(ths, vert1, vert2, color) {
            alert('called');
        }
    }]);

    Box2D.customizeVTable(debugDraw, [{
    original: Box2D.b2Draw.prototype.DrawPolygon,
    replacement:
        function(ths, vertices, vertexCount, color) {
            alert('called');
        }
    }]);

    Box2D.customizeVTable(debugDraw, [{
    original: Box2D.b2Draw.prototype.DrawSolidPolygon,
    replacement:
        function(ths, vertices, vertexCount, color) {
            alert('called');
        }
    }]);

    Box2D.customizeVTable(debugDraw, [{
    original: Box2D.b2Draw.prototype.DrawCircle,
    replacement:
        function(ths, center, radius, color) {
            alert('called');
        }
    }]);

    Box2D.customizeVTable(debugDraw, [{
    original: Box2D.b2Draw.prototype.DrawSolidCircle,
    replacement:
        function(ths, center, radius, axis, color) {
            alert('called');
        }
    }]);

    Box2D.customizeVTable(debugDraw, [{
    original: Box2D.b2Draw.prototype.DrawTransform,
    replacement:
        function(ths, transform) {
            alert('called');
        }
    }]);

    return debugDraw;
}

Do I need to recompile Box2D to change this setting?

Edit: Yes, it appears I do.

samowitsch commented 10 years ago

Why recompile? I have the same problem....

Joncom commented 10 years ago

Because the setting that the error message says to change is a setting used only at compile time. If you know where in the final JavaScript file the setting takes effect, you could change it yourself and not recompile. However, I cannot remember where/what exactly to change...

kripken commented 10 years ago

Should be functionPointers: .., can change it to functionPointers: new Array(1024) for example.

On Mon, Sep 23, 2013 at 2:14 PM, Jonathan Commins notifications@github.comwrote:

Because the setting that the error message says to change is a setting used only at compile time. If you know where in the final JavaScript file the setting takes effect, you could change it yourself and not recompile. However, I cannot remember where/what exactly to change...

— Reply to this email directly or view it on GitHubhttps://github.com/kripken/box2d.js/issues/25#issuecomment-24955228 .

samowitsch commented 10 years ago

"functionPointers:" ?

Joncom commented 10 years ago

Yeah. Odd. I see functionPointers in my local copy of box2d.js, but not in the one in the latest repo. It's not there.

kripken commented 10 years ago

Repo one might be minified, so harder to find - might need to rebuild it then.

On Thu, Sep 26, 2013 at 4:41 PM, Jonathan Commins notifications@github.comwrote:

Yeah. Odd. I see functionPointers in my local copy of box2d.js, but not in the one in the latest repo. It's not there.

— Reply to this email directly or view it on GitHubhttps://github.com/kripken/box2d.js/issues/25#issuecomment-25212732 .