Sign in to follow this  

Pixel perfect framebuffers?

This topic is 3676 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

Is it possible to render a scene into a framebuffer, then draw that framebuffer texture to screen and have it look as crisp as the original scene? I'm sure it should be possible, but no matter what I've tried it always ends up looking like it's been resampled. Any suggestions would be much appreciated

Share this post


Link to post
Share on other sites
Yes, absolutely.
If you have a newer graphics card, you should be able to create textures that match the resolution of the screen perfectly.
However, if you intend to use the fullscreen textures inside shaders, it's possible you'll have to use texture rectangles. (GL_TEXTURE_RECTANGLE_ARB extension).

Share this post


Link to post
Share on other sites
It's simple. Make your texture the example size. You can use a large 2D texture and use only the portion you need if you want to avoid NPOT textures.
Set filter mode to GL_NEAREST but I think this shouldn't be necessary.

Share this post


Link to post
Share on other sites
Hmph, that's a pity. I was hoping I was missing a glEnable(NON_FUCKED_TEXTURING) setting...

I'll continue to prod, see if I can come up with a simple test case

Share this post


Link to post
Share on other sites
1. How are you loading your textures? If you're using gluBuild2DMipmaps then stop right now and go back and read the docs.

2. What size of texture are you creating? For maximum compatibility is is often best to create a texture of power-of-two dimensions any only use a subset.

3. What is your code for drawing it to screen? You have to be *very* careful with your vertex coords and texture coords to get it to map exactly from one texel to one pixel. Adding a small offset (say, +0.35) can correctly line up the texel centers with the pixel sampling positions. This is a non-trivial subject but you can find a lot by googling around.

Share this post


Link to post
Share on other sites

This topic is 3676 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this