RobLoach / node-raylib

Node.js bindings for Raylib
https://robloach.github.io/node-raylib/
Other
242 stars 20 forks source link

TriangleStrip and TriangleFan #66

Open armageddon421 opened 4 years ago

armageddon421 commented 4 years ago

Can you please provide an example on how to pass the Vector2 *points in there?

I tried this, but the application just closes without any error message:

let p = [
                    r.Vector2(x,y),
                    r.Vector2(x + h,y + h),
                    r.Vector2(x + w,y),
                    r.Vector2(x + w + h, y + h)
                ]

                r.DrawTriangleStrip(p, 4, color)

I'm testing on Windows right now, npm installed just today. I also tried different vertex orders.

RobLoach commented 4 years ago

Is there an example in raylib that has one? We could port it over and adapt the code as needed. For a few of the pointer-based methods, I had to make wrapper functions.

armageddon421 commented 4 years ago

I just found this issue on raylib, it's probably related. It seems to exit without error there, too.

https://github.com/raysan5/raylib/issues/1223

Looking at the last comment from raysan, I'll probably not take too much of a performance hit by using separate triangles for everything for now. We should review this issue after node-raylib has been updated to the latest raylib.