Jump to content
  • Advertisement
Sign in to follow this  
irreversible

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

This topic is 2104 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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. Edited by irreversible

Share this post


Link to post
Share on other sites
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 Edited by Kaptein

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!