What is Text object?

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
Sasha264
Citizen
Posts: 60
Joined: Mon Sep 08, 2014 7:57 am

What is Text object?

Post by Sasha264 » Sat Aug 24, 2019 10:49 am

Hello folks! :awesome:

Here is an opportunity to create Text objects https://love2d.org/wiki/love.graphics.newText
instead of drawing text every frame with https://love2d.org/wiki/love.graphics.printf
Used it a dozen times and it really improves performance.

But I don't understand what exactly a Text object is?
Pixel buffer like canvas? Set of glyphs and coordinates? Or something else?

Is it ok to store hundreds of paged text with Text object, created for every "page"?
As far as I see with https://love2d.org/wiki/love.graphics.getStats
it does not increase vram consumption, but maybe here is some other issues?
Attachments
text-objects.png
text-objects.png (710.79 KiB) Viewed 1954 times

bobbyjones
Party member
Posts: 720
Joined: Sat Apr 26, 2014 7:46 pm

Re: What is Text object?

Post by bobbyjones » Sat Aug 24, 2019 1:11 pm

I believe it is like a sprite batch or mesh of sorts that batch the calls so that all of the text is drawn only once
Do you frequently have great ideas but immediately lose them? Check out the MVP for my website called IdeaVault. It is designed to solve that problem. Desktop browsers only currently.

User avatar
Sasha264
Citizen
Posts: 60
Joined: Mon Sep 08, 2014 7:57 am

Re: What is Text object?

Post by Sasha264 » Tue Aug 27, 2019 7:51 pm

Thanks! That's a good idea! I will believe it that too :3

User avatar
ivan
Party member
Posts: 1530
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: What is Text object?

Post by ivan » Wed Aug 28, 2019 5:58 am

I don't know much about the inner workings of Love2D but I suspect that the text object is a vertex buffer with UV information mapped with the rasterized font texture (spaced/kerned accordingly). It probably does consume a little bit of VRAM.

User avatar
Sasha264
Citizen
Posts: 60
Joined: Mon Sep 08, 2014 7:57 am

Re: What is Text object?

Post by Sasha264 » Sun Sep 01, 2019 7:50 pm

ivan wrote:
Wed Aug 28, 2019 5:58 am
Thanks! :cool:

Post Reply

Who is online

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