Page 1 of 1

More possibilities for image rendering :P

Posted: Fri Oct 24, 2008 12:02 pm
by Borsty
Hi, I'm working on a little game ( won't tell you what it is now, I'm still working on some kind of engine for it ) and I'm missing more advanced possibilities to use images.
As you're using openGL would it be too much to ask for some kind of U/V mapping and / or vertex coloring possibilities? :D

Re: More possibilities for image rendering :P

Posted: Fri Oct 24, 2008 1:24 pm
by rude
Major enhancements to love.graphics in general are planned, but specifics depend om community input, so feature requests can only be a good thing.

There is usually a tradeoff between flexibility and performance, especially when dealing with data transfers between Lua and C. I assume we should take the stateful approach in this case, in order to not kill performance entirely.

How would you want the code to look like (for UV mapping, vertex coloring, etc)?

Re: More possibilities for image rendering :P

Posted: Fri Oct 24, 2008 1:56 pm
by Borsty
Maybe something like

Code: Select all

love.graphics.rawtriangle( style, image, pointA, pointB, pointC )
and point* parameters could be tables with X, Y, U, V, R, G, B and A values

Re: More possibilities for image rendering :P

Posted: Tue Oct 28, 2008 11:36 am
by rude
Yeah, that would be flexible, but not very fast. If we want speed, we would also need something like:

Code: Select all

img = love.graphics.newImage("textures/tex.png")

-- These buffers represent C arrays.
vex = love.graphics.newVertexBuffer( table )
tex = love.graphics.newTexelBuffer( table )
clr = love.graphics.newColorBuffer( table )

-- Change some values:
clr[0] = 255
clr[1] = 0
vex[0] = 255

love.graphics.drawb( love.draw_triangles, vex, tex, clr, img, start, end)
Vex, tex and clr can either be native buffers or Lua tables. The former being fast, the latter being flexible.