KilledByAPixel / LittleJS

LittleJS is a fast HTML5 game engine with many features and no dependencies. 🚂 Choo-Choo!
MIT License
3.19k stars 160 forks source link

Proof-of-concept: Instanced rendering #82

Closed codyebberson closed 2 months ago

codyebberson commented 2 months ago

See discussion #78

This is a quick-and-dirty proof-of-concept of using instanced rendering to draw sprites.

Before: https://killedbyapixel.github.io/LittleJS/examples/stress/

After: https://codyebberson.github.io/LittleJS/examples/stress/

Pros: Faster, less data sent to GPU per frame

Cons: Not compatible with glDrawPoints or glRenderPostProcess - to use both instanced rendering and preserve backwards compatibility would require additional shaders.

KilledByAPixel commented 2 months ago

Fantastic work, Cody! I am checking this out now. Im sure I can get the post process working again, we can cut gldraw points as a feature if necessary, i had only added it because it fit so naturally with the old method.

I will fix up the post process to work.

KilledByAPixel commented 2 months ago

It seems to work great already so I'm going to pull this all in then go through and make any small changes i want and fix the post processing and cut the glDrawPoints.