How to cache drawing operations?

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
User avatar
appleide
Party member
Posts: 323
Joined: Fri Jun 27, 2008 2:50 pm

How to cache drawing operations?

Post by appleide »

I'm trying to draw antialiased arcs and circles but they slow down the environment alot. So i thought of trying to cache them by drawing them to an image or something.

I looked through the documentation and turns out there is a way - draw to a framebuffer. I tried it but I got an error message "not supported by your opengl implementation". Even if my computer would support it, it meant that the feature isn't portable. =\

I thought of drawing to an image, but there is no way to redirect drawing operations to images... that means I have to come up with a copy of every love.graphics drawing operation, (polygon, rectangle, line, etc...).

Maybe I should just switch to a computer with a complete opengl driver...
User avatar
BlackBulletIV
Inner party member
Posts: 1261
Joined: Wed Dec 29, 2010 8:19 pm
Location: Queensland, Australia
Contact:

Re: How to cache drawing operations?

Post by BlackBulletIV »

Your computer may yet support framebuffers. Make sure not to create a framebuffer with a non-Po2 resolution. Create one with something like 32x32, 64x64, 128x128 ... 1024x1024.
appleide wrote:I thought of drawing to an image, but there is no way to redirect drawing operations to images... that means I have to come up with a copy of every love.graphics drawing operation, (polygon, rectangle, line, etc...).
ImageData might be what you're looking for. You can then convert an ImageData object into an Image to be drawn. Make sure you don't do this heaps, it's not the fastest thing in the world.
User avatar
appleide
Party member
Posts: 323
Joined: Fri Jun 27, 2008 2:50 pm

Re: How to cache drawing operations?

Post by appleide »

BlackBulletIV wrote:Your computer may yet support framebuffers. Make sure not to create a framebuffer with a non-Po2 resolution. Create one with something like 32x32, 64x64, 128x128 ... 1024x1024.
appleide wrote:I thought of drawing to an image, but there is no way to redirect drawing operations to images... that means I have to come up with a copy of every love.graphics drawing operation, (polygon, rectangle, line, etc...).
ImageData might be what you're looking for. You can then convert an ImageData object into an Image to be drawn. Make sure you don't do this heaps, it's not the fastest thing in the world.
Yeah, but then I'd have to rewrite all those functions for use on images... :/

Also, noticed there's no way to convert framebuffers into imagedata; You can't seem to save stuff from the screen into a file?
User avatar
TechnoCat
Inner party member
Posts: 1611
Joined: Thu Jul 30, 2009 12:31 am
Location: Denver, CO
Contact:

Re: How to cache drawing operations?

Post by TechnoCat »

appleide wrote:Also, noticed there's no way to convert framebuffers into imagedata; You can't seem to save stuff from the screen into a file?
http://love2d.org/wiki/Framebuffer:getImageData
http://love2d.org/wiki/love.graphics.newScreenshot
and http://love2d.org/forums/viewtopic.php? ... ving+image
User avatar
appleide
Party member
Posts: 323
Joined: Fri Jun 27, 2008 2:50 pm

Re: How to cache drawing operations?

Post by appleide »

TechnoCat wrote:
appleide wrote:Also, noticed there's no way to convert framebuffers into imagedata; You can't seem to save stuff from the screen into a file?
http://love2d.org/wiki/Framebuffer:getImageData
http://love2d.org/wiki/love.graphics.newScreenshot
and http://love2d.org/forums/viewtopic.php? ... ving+image
:emo: I just wasn't looking hard enough before I made that comment.
User avatar
NÖÖB
Prole
Posts: 41
Joined: Thu Jul 31, 2008 10:57 pm
Location: Norway

Re: How to cache drawing operations?

Post by NÖÖB »

Here's another example of drawing to an image:
http://love2d.org/forums/viewtopic.php?f=5&t=2576
Post Reply

Who is online

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