What do framebuffers DO?

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
Taehl
Dreaming in associative arrays
Posts: 1025
Joined: Mon Jan 11, 2010 5:07 am
Location: CA, USA
Contact:

What do framebuffers DO?

Post by Taehl »

Can I, for instance, render some stuff to a framebuffer, then manipulate them? Say, render them with a mask? That'd be handy. If not, then what, exactly, is the point of using a framebuffer instead of just drawing stuff (or drawing stuff to a spritebatch)?
Earliest Love2D supporter who can't Love anymore. Let me disable pixel shaders if I don't use them, dammit!
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: What do framebuffers DO?

Post by Robin »

Taehl wrote:If not, then what, exactly, is the point of using a framebuffer instead of just drawing stuff (or drawing stuff to a spritebatch)?
A SpriteBatch is a very different beast. They are useful for things like tile sets.

To a Framebuffer, you can draw anything you can draw to screen as well. What's nice is that you only have to draw this once -- which I use in AStrat, where the the map is created by drawing pixels (rectangles, actually), which would be excruciatingly slow if not for Framebuffers. And that's just the beginning.
Help us help you: attach a .love.
User avatar
Mud
Citizen
Posts: 98
Joined: Fri Nov 05, 2010 4:54 am

Re: What do framebuffers DO?

Post by Mud »

Robin wrote:which I use in AStrat
<ot>What's that?</ot>
User avatar
Taehl
Dreaming in associative arrays
Posts: 1025
Joined: Mon Jan 11, 2010 5:07 am
Location: CA, USA
Contact:

Re: What do framebuffers DO?

Post by Taehl »

It's a fractal animation he made which crashes after ten seconds.

So, the only difference between using a framebuffer and drawing directly to the screen is that framebuffers aren't cleared after every frame?
Earliest Love2D supporter who can't Love anymore. Let me disable pixel shaders if I don't use them, dammit!
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: What do framebuffers DO?

Post by Robin »

Mud wrote:
Robin wrote:which I use in AStrat
<ot>What's that?</ot>
This:
astrat.love
Requires 0.7.0, obviously
(2.11 KiB) Downloaded 128 times
And it doesn't crash any more, btw.
Taehl wrote:So, the only difference between using a framebuffer and drawing directly to the screen is that framebuffers aren't cleared after every frame?
If you mean what I think you mean, then yes. They are very, very useful. I use Framebuffers in RichText as well.
Help us help you: attach a .love.
User avatar
Taehl
Dreaming in associative arrays
Posts: 1025
Joined: Mon Jan 11, 2010 5:07 am
Location: CA, USA
Contact:

Re: What do framebuffers DO?

Post by Taehl »

Okay, so, does Love have any way of letting me get at OpenGL's fragment shaders?
Earliest Love2D supporter who can't Love anymore. Let me disable pixel shaders if I don't use them, dammit!
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
User avatar
vrld
Party member
Posts: 917
Joined: Sun Apr 04, 2010 9:14 pm
Location: Germany
Contact:

Re: What do framebuffers DO?

Post by vrld »

Taehl wrote:Can I, for instance, render some stuff to a framebuffer, then manipulate them? Say, render them with a mask?
With the current blendmodes it is difficult. You can use the subtractive mode to have something like an inverse stencil/hole puncher:
1. Paint with alpha 255 (and possibly the color white) what you don't want to have on the screen to a framebuffer.
2. Paint something to the screen.
3. Set blendmode to subtractive.
4. Paint framebuffer.
5. ???
6. Profit.
Taehl wrote:Okay, so, does Love have any way of letting me get at OpenGL's fragment shaders?
Not yet, but if you can build love from source there is love-glsl. There is also a feature request.
If you need help using it, just can just PM me :)
I have come here to chew bubblegum and kick ass... and I'm all out of bubblegum.

hump | HC | SUIT | moonshine
User avatar
thelinx
The Strongest
Posts: 857
Joined: Fri Sep 26, 2008 3:56 pm
Location: Sweden

Re: What do framebuffers DO?

Post by thelinx »

Robin wrote:
Mud wrote:
Robin wrote:which I use in AStrat
<ot>What's that?</ot>
This:
astrat.love
And it doesn't crash any more, btw.
a-awesome

(an hour later)

best waste of an hour ever
User avatar
zac352
Party member
Posts: 496
Joined: Sat Aug 28, 2010 8:13 pm
Location: In your head.
Contact:

Re: What do framebuffers DO?

Post by zac352 »

Taehl wrote:So, the only difference between using a framebuffer and drawing directly to the screen is that framebuffers aren't cleared after every frame?
Clearing the screen is done with love.graphics.clear() and love.graphics.present(). They are called from the default love.run function. The default love.run function does not draw/clear framebuffers. :P
Hello, I am not dead.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: What do framebuffers DO?

Post by Robin »

thelinx wrote:a-awesome

(an hour later)

best waste of an hour ever
Thanks. :nyu: I want to get the different nations to attack each other, but I have no idea how to do that in a way that doesn't look awful as of yet.
Help us help you: attach a .love.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 22 guests