love.graphics.circle vs love.graphics.polygon

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
undef
Party member
Posts: 438
Joined: Mon Jun 10, 2013 3:09 pm
Location: Berlin
Contact:

love.graphics.circle vs love.graphics.polygon

Post by undef »

I just wondered why love.graphics.circle and love.graphics.arc are so inefficient.
A Mesh or even love.graphics.polygon performs a lot better.
Is there any reason to use love.graphics.circle over love.graphics.polygon?
twitter | steam | indieDB

Check out quadrant on Steam!
User avatar
slime
Solid Snayke
Posts: 3132
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: love.graphics.circle vs love.graphics.polygon

Post by slime »

Are you comparing love.graphics.circle to a love.graphics.polygon call which has the same number of segments as the love.graphics.circle? They should have almost the same performance in that case.
User avatar
undef
Party member
Posts: 438
Joined: Mon Jun 10, 2013 3:09 pm
Location: Berlin
Contact:

Re: love.graphics.circle vs love.graphics.polygon

Post by undef »

Hmm, I don't know what the default number of segments for love.graphics.circle is,
but when drawing many circles with different changing radii I get sudden framerate drops that I don't get with love.graphics.polygon.

My custom circle function uses up to 2^12 segments, depending on the radius.

Instead of love.graphics.arc I use a mesh, because when drawing 6 arcs I get 15 FPS with love.graphics.arc, while I get 46 FPS with a mesh.
This may of course not make a difference on stronger hardware.
twitter | steam | indieDB

Check out quadrant on Steam!
User avatar
slime
Solid Snayke
Posts: 3132
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: love.graphics.circle vs love.graphics.polygon

Post by slime »

Meshes will almost always get better performance than love.graphics.circle/polygon/etc. if you aren't calling Mesh:setVertex a bunch every frame, since drawing the mesh just tells the graphics driver to draw vertices that are already living in VRAM, whereas love.graphics.circle/etc. have to upload the vertices and tell the graphics driver to draw them in the same function.
User avatar
molul
Party member
Posts: 264
Joined: Sun Feb 05, 2012 6:51 pm
Location: Valencia, Spain
Contact:

Re: love.graphics.circle vs love.graphics.polygon

Post by molul »

slime wrote: Sat Jan 10, 2015 9:40 pm Meshes will almost always get better performance than love.graphics.circle/polygon/etc. if you aren't calling Mesh:setVertex a bunch every frame
Sorry for the necrobump, but I'm having a problem exactly. I need to update only the V texture coordinate for a mesh, but for that I only see mesh:setVertex, and I'm having a significant performance drop because of that. Would there be a way to only update the V texture coordinate, or U and V only, instead of changing all the vertices?
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 115 guests