Quantcast
Channel: openFrameworks - Latest posts
Viewing all articles
Browse latest Browse all 40524

Incorrect float colors & GL_RGBA32Float fbo's - banding

$
0
0

When I use a minimal fragment shader to set the color; it works as expected:

#version 120
uniform float c;
void main() {
    gl_FragColor = vec4(c, c, c, 1.0f);
}

and this is the draw code:

float requested = ofGetElapsedTimef()/100.; //gradual fade
fbo.begin();
	ofSetColor(255);
	ofFill();
	shader.begin();
	shader.setUniform1f("c", requested);
	ofRect(0, 0, 640, 480);
	shader.end();
fbo.end();

then this is the correct, and expected, result:

[notice ] Requested: 0.00456789  received in fbo pixels: 0.00456789
[notice ] Requested: 0.00481678  received in fbo pixels: 0.00481678
[notice ] Requested: 0.00514384  received in fbo pixels: 0.00514384
[notice ] Requested: 0.00547703  received in fbo pixels: 0.00547703
[notice ] Requested: 0.00581285  received in fbo pixels: 0.00581285

etc

So it appears to be a (float)color issue.
I got identical problems as in the first post when using the short (16bit) color

any hints as how to use the float color correclty? Am I missing something obvious?

thanks!


Viewing all articles
Browse latest Browse all 40524

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>