Skip to main content
gamedev.net
🔒 Locked

Framebuffer Object Size - Screen size

Started by gagabla Apr 23, 2009 at 6:36 AM 4 replies 4.5k views
Original Post
gagabla
gagabla
Hi, to do postprocessing on my rendered graphics, i first render to a framebuffer object and then use its texture and shaders, to render the final image to the screen. My problem ist now, that the frambebuffers with and heigth have to be a power of two (as all textures). My Screenresolution (for fullscreen) is 1680px*1050px which is obviously in neither direction a power of two. Now what is the best solution for this? Do i have to size my framebuffer to 2048px*2048px, render into it, and then draw only the upper left rectangle of my screensize? Scaling the image up is not a solution for me, i dont want the final image to be interpolated. What about performance? Is it possible to only render the part i realy need into the oversized framebuffer? BR janosch
bubu LV
bubu LV
Yes, you can render to part of framebuffer. Use glViewport to set desired part of FBO to use for rendering.

But you can easily use not-power-of-two sizes for framebuffer and textures. Any modern card supports NPOT textures (in OpenGL 2.0 it is mandatory). See GL_ARB_texture_non_power_of_two extension.

On older video cards you can use GL_ARB_texture_rectangle extension.

Read also this: http://opengl.org/wiki/NPOT_Textures
gagabla
gagabla
Hi,
thanks for your reply. I tried giving my framebuffer NPOT size, (i get GL_ARB_texture_non_power_of_two in my extension-string!), but then the framebuffer status is beeing set to GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT.
Using POT size, everything works fine.

Any Idea, what could be the problem?
BR, Janosch
bubu LV
bubu LV
According to spec FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT error is happening when following proposition is false:
Quote:
All attached images have the same width and height.
mightypigeon
mightypigeon
Yes, non power of 2 textures should "just work". Make sure any renderbuffer attachments such as depth, stencil and all color buffers are the same size.

FBO's are great when they work, but a pain when tracking down little things like that :) especially since you normally end up scouring the extension spec with a fine tooth comb.
[size="1"]
gagabla
gagabla
Very strange.
I only change the render resolution in one place in my application,
these definitions are used in every place, the rendering resolution is needed.
So from the fact, that it works with a resolution of 512x512 AND works,
with a resolution of 1024x1024 i conclude, that the resolution is set
consistently on all framebuffer dependants. But setting a NPOT resolution,
i get the incomplete dimensions status. WTF?

BR Janosch

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.