Fragment shader output higher than 1

Hi !

I’d like to simulate a reaction diffusion system whith the GPU.

I’m using a swap buffer to perform this.
A circle in the middle of the sceen is supposed to grow, but unstead it becomes smaller because high values are cliped to one, so my image is loosing values.

How can I solve this problem ? Or how can I allow a Fbo to have values higher than one ?

Thanks :slight_smile:

Nicolas

Problem solved. For those who face this problem, here’s the explication.

The default behaviour of ofFbo is GL_RGBA, which represents a image coded with intergers (8 bits per channel), which happends when you write this

srcBuffer->allocate(ofGetWidth(), ofGetHeight());

so what you should do is :

allocate(ofGetWidth(), ofGetHeight(), GL_RGBA32F);

so the method which sets up my dual buffer looks like

void SwapBuffer::initBuffers(){
    srcBuffer = new ofFbo();
    srcBuffer->allocate(ofGetWidth(), ofGetHeight(), GL_RGBA32F );
    dstBuffer = new ofFbo();
    dstBuffer->allocate(ofGetWidth(), ofGetHeight(), GL_RGBA32F );
}
1 Like