Render-to-texture different from render-to-framebuffer

Started by
4 comments, last by irreversible 11 years, 7 months ago
I have my regular GUI code looking the way I expect it to. However, due to certain optimization requirements, I'm now trying to double buffer portions of my GL-drawn window controls. This has brought up an unexpected surprise - there are minor differences between the double buffered and the directly drawn graphics.

Attached are two images - the first one is the direct draw result and the second one is unscaled FBO output blitted into the frame buffer (a matching quad drawn in ortho mode). Images are captured via PrintScreen, not copied from the GPU. I've blown them up 400% (no interpolation) to accentuate the minuscule changes - notably the corners of the rects are visibly different, even at 100%.

The FBO target has filter mode set to GL_NEAREST for both min and max, it's a 32 bit non-float RGBA image (same as the frame buffer) and mipmaps are disabled.

It's hard to post code unless I know where to look as everything's neck-deep in a larger framework.

I'm probably missing something really obvious here so if anyone can point it out, that'd be awesome smile.png

Note - the one-pixel vertical blur on the right of the rects in the first image is due to a 0.1 subpixel shift to emulate slight antialiasing. Looks better at 100%.

[attachment=11216:gui1.png][attachment=11217:gui2.png]
[attachment=11220:gsl3.png]
Edit: added the third screenshot of a GL_LINEAR/GL_LINEAR target.
Advertisement
well, nearest doesn't interpolate any values
so, thats why its different.. the old image obviously had bilinear (cheap) interpolation biggrin.png
write quintic interpolation in your frag shader! or not, depending onwhat you need
lots of funky curves to make the pixels smooth.. but since its a pixel game, maybe not

please not that bilinear only looks like crap when you zoom in lots, like walking up to a mesh in a (any) first-person game
I added a,interpolated version of the FBO target (min and mag filters set to GL_LINEAR) to the original post. Notice the lack of detail.

In any case, the problem seems to be elsewhere.
ok clearly you have a megazoomed image, so no bilinear
but subpixel shift, i dont understand, you CANT get mixed colors with nearest unless you do it by hand in shaders
and make sure the screensize is at least an even number...
The FBO target has filter mode set to GL_NEAREST for both min and max
Is this regarding the step where you blit the FBO to the screen, or the step where you render your GUI into the FBO?
This is for the FBO target (eg the texture that the GUI is rendered to). Like I said, I'm probably missing something really obvious here, but I don't see why it would affect texture drawing to the screen.

This topic is closed to new replies.

Advertisement