Hey,
I'm new to LÖVE, but out of all engines I've tried so far, i LOVE(couldn't resist, sorry) this one the most. I have an issue however, I'm starting development of a 2.5D game where Im doing whole projection math myself and therefore I have to draw all the polygons myself too.
Currently Im doing over a 1000 love.graphics.polygon calls (fill mode, convex) per DRAW cycle and so far it's all smooth. However I'll have to render more stuff eventually, and when I artificially inflate that number to 10k to test things out - FPS starts to fall.
So the question really - maybe there's a more optimal way to draw a lot of shapes than doing thousands of love.graphics.polygon calls per frame ?
Thank you all in advance !
Performance - custom draw
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: Performance - custom draw
every love.graphics.polygon assembles a new shape in a buffer and sends it, each frame (I would presume). A Mesh should help:midnightjack wrote: ↑Mon Mar 13, 2017 1:50 am Hey,
I'm new to LÖVE, but out of all engines I've tried so far, i LOVE(couldn't resist, sorry) this one the most. I have an issue however, I'm starting development of a 2.5D game where Im doing whole projection math myself and therefore I have to draw all the polygons myself too.
Currently Im doing over a 1000 love.graphics.polygon calls (fill mode, convex) per DRAW cycle and so far it's all smooth. However I'll have to render more stuff eventually, and when I artificially inflate that number to 10k to test things out - FPS starts to fall.
So the question really - maybe there's a more optimal way to draw a lot of shapes than doing thousands of love.graphics.polygon calls per frame ?
Thank you all in advance !
https://love2d.org/wiki/love.graphics.newMesh
https://love2d.org/wiki/Mesh
you can set the usage hint if you plan to update it each frame and its still gonna be faster than polygon, but really you want to use transform and get away with using the mesh static.
On the other hand though, if you do the projection math yourself, why not draw regularily and handle that in a vertex shader? That's exactly what it's designed for and you get full hardware acceleration.
-
- Prole
- Posts: 2
- Joined: Mon Mar 13, 2017 1:36 am
Re: Performance - custom draw
Hey! Thanks so much for the response. To answer your question - that's because I never really programmed anything that would use hardware acceleration before, so I even didn't think of that. But that's probably what I'll go with, since I want maximum performance.
If you (or anyone reading this) have any links for beginners on using vertex shaders in LOVE - that'd be greatly appreciated! Thanks again!
Re: Performance - custom draw
so what you are writing is a vertex shader, for OpenGL, written in GLSL, googling this should give you a lot.midnightjack wrote: ↑Mon Mar 13, 2017 2:27 amHey! Thanks so much for the response. To answer your question - that's because I never really programmed anything that would use hardware acceleration before, so I even didn't think of that. But that's probably what I'll go with, since I want maximum performance.
If you (or anyone reading this) have any links for beginners on using vertex shaders in LOVE - that'd be greatly appreciated! Thanks again!
you can find the default vertex shader for love here and work off that:
https://love2d.org/wiki/love.graphics.newShader
Code: Select all
vec4 position(mat4 transform_projection, vec4 vertex_position)
{
// The order of operations matters when doing matrix multiplication.
return transform_projection * vertex_position;
}
Who is online
Users browsing this forum: Ahrefs [Bot] and 10 guests