Howdy folks! I'm hooking up LiquidFun to Lua/Love2D with LuaBridge and having trouble with rendering. Most of the work getting the two to talk is already done, but I'm having a spot of bother rendering it. LiquidFun stores its liquid particle positions in a contiguous buffer in memory to make calling things like glVertexPointer the efficient way to render them. The closest equivalent to glVertexPointer in Love2D would be SpriteBatch, but I can't figure out how to give SpriteBatch a pointer to the positions buffer.
Is there a good way to do this without modifying and recompiling Love? I could rewrite or modify SpriteBatch itself, but I'd love to make it easier to distribute my LiquidFun bindings.
Hooking up SpriteBatch to vertex buffer?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- slime
- Solid Snayke
- Posts: 3162
- Joined: Mon Aug 23, 2010 6:45 am
- Location: Nova Scotia, Canada
- Contact:
Re: Hooking up SpriteBatch to vertex buffer?
[wiki]Mesh[/wiki]es are the closest thing to Vertex Buffers in LÖVE, currently.
[wiki]Mesh:setVertices[/wiki] can also accept a [wiki]Data[/wiki] object as of 0.10.0 (although I haven't documented that on the wiki yet), and you can copy bytes to a Data object with the FFI by using [wiki]Data:getPointer[/wiki] and [wiki]Data:getSize[/wiki] with ffi.copy.
[wiki]Mesh:setVertices[/wiki] can also accept a [wiki]Data[/wiki] object as of 0.10.0 (although I haven't documented that on the wiki yet), and you can copy bytes to a Data object with the FFI by using [wiki]Data:getPointer[/wiki] and [wiki]Data:getSize[/wiki] with ffi.copy.
Re: Hooking up SpriteBatch to vertex buffer?
Ah, good idea. I'm able to get that about 50% working, but I can't seem to get Mesh to render Point Sprites. I can get it rendering uniform squares taken from one texture coordinate, but nothing like this. Before I go about writing a vertex shader to transform the point into a quad, is there something I'm missing inside of Mesh that would do what I want?
- slime
- Solid Snayke
- Posts: 3162
- Joined: Mon Aug 23, 2010 6:45 am
- Location: Nova Scotia, Canada
- Contact:
Re: Hooking up SpriteBatch to vertex buffer?
LÖVE doesn't provide a way to enable/use point-sprite rendering.
Re: Hooking up SpriteBatch to vertex buffer?
Gotcha. Alright, I'll use SpriteBatch until performance seems to be a non-starter, then write a fragment shader to try and make it work.
Who is online
Users browsing this forum: Bing [Bot] and 3 guests