0
\$\begingroup\$

Say I have an openGL screen and I want to render part of the screen in different pixel density than the whole screen pixel density. Is it possible and if possible how?

\$\endgroup\$
8
  • 1
    \$\begingroup\$ "different pixel density" What does that mean? \$\endgroup\$ Commented Jan 20, 2013 at 8:27
  • \$\begingroup\$ @NicolBolas say you have a screen rendered with 640*480 resolution, so the pixels per inch (pixel density) will be same across the screen, now I want to vary this pixel density of the scene in different part of the screen. Say I have a scene having different objects. Now I want to render some of the objects with more resolution than the other. I was thinking of the possibility of this optimization, but I'm not sure if it can be done with any existing 3D API's like openGL. \$\endgroup\$
    – Masum
    Commented Jan 20, 2013 at 8:48
  • \$\begingroup\$ I doubt you can do that. You can cheat the looks of it by rendering to different frame buffers depending on the resolution you want and then putting the image together, but that's not an optimization. What you want is Level of Detail. Models with reduced polygon counts, mip-mapping, etc. \$\endgroup\$
    – dreta
    Commented Jan 20, 2013 at 8:53
  • 1
    \$\begingroup\$ is software.intel.com/en-us/articles/… what you were thinking of doing? \$\endgroup\$
    – Adam
    Commented Jan 20, 2013 at 14:43
  • \$\begingroup\$ @Adam I had a look at this before asking here. The concept is somewhat similar, but what I wanted to do is vary the resolution of part of the scene instead of changing the whole scene resolution. I'm wondering if doing such stuff is possible with any existing 3D API's (openGL/directX) out there. \$\endgroup\$
    – Masum
    Commented Jan 20, 2013 at 15:25

1 Answer 1

3
\$\begingroup\$

Sure. Figure out which portions of the screen you want to render at what resolutions, and render them into FBOs of appropriate sizes.

Once you have your different elements rendered into separate FBOs, you can then composite them together into the main framebuffer using glBlitFramebuffer().

Or alternately, if you don't want to composite them together as complete rectangles (which is what glBlitFramebuffer() will do), then you can bind the various FBOs as textures, and draw from them to the main framebuffer with triangles, in whatever manner suits your desired effect.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .