DrawSolidPolygon() ..... Swig director method error

Hi !
I'm using pyBox2D 2.0.2b2 and I get this error when I try to run the testbed examples:

Code: Select all

TypeError: "DrawSolidPolygon() takes exactly 4 arguments (3 given) Swig director method error Error detected when calling 'b2DebugDraw.DrawSolidPolygon'"


Is this related to my installation of box2D ?

Thanks 🙂
Hi MrGecko,

I believe the problem is that I did not inform users properly about the upgrades I did for the old pybox2d 2.0.2b1 (I've really only been working on the 2.1 version and the pure Python port recently).

It was initially just a quick fix for the memory leak that I had found. But then I figured "what the heck", and gave it a few niceties such as removing the ugly getAsType(), and removing the redundant polygon vertex count from the parameter lists of b2DebugDraw -- which the bug you are running into now. I'll have to document these changes sometime, but my hope is that any remaining users will move to 2.1 soon.

TL;DR: Remove the vertex_count parameter, and it should work again.

kne
Hi,
Could you be more specific about which files must be fixed? I couldn't find the VertexCount parameter you mentioned.

Cheers
midnite_cowboy,

Sorry for the late response --

As you can see in this diff, vertexCount parameters in the Draw*Polygon callbacks of b2DebugDraw have been removed. The same is also true for all other backends (pyglet, etc.). This means if you are using debug drawing you should change in either your debug drawing code or mine (e.g., pygame_main.py):

Code: Select all

    def DrawSolidPolygon(self, vertices, vertexCount, color):   

to

Code: Select all

    def DrawSolidPolygon(self, vertices, color):   

The same goes for DrawPolygon.
The same is also true for all other backends.
เว็บคาสิโนออนไลน์

Original thread: https://box2d.org/forum/viewtopic.php?t=7058