4

I want to render a scene with specific camera parameters where the resolution is very high (say 20,000 x 20,000 pixels), but I actually am only interested in doing a small 640x480 section of the image plane.

I don't necessarily want to just zoom in on the section and alter where the camera is pointing. I want the camera to stay pointing in the same direction, I just only want to render a small portion of the scene.

I have attached a picture to try and show what I am talking about: Uploaded image

Any hints on how I can setup the camera matrix with OpenGL calls properly for something like this?

Andon M. Coleman
  • 42,359
  • 2
  • 81
  • 106
Bobby Pardridge
  • 267
  • 6
  • 16
  • I highly doubt you will find an OpenGL implementation capable of rendering into a 20,000 x 20,000 framebuffer (you might need to split the task of rendering into tiles to accomplish this). But one thing you might consider is called the scissor box, this allows you to crop rasterization into a sub-rectangle of your viewport. Unlike modifying the actual viewport mapping, this will not modify your projection characteristics. See: `glScissor (...)` for more details. – Andon M. Coleman Oct 01 '13 at 05:23
  • It is a raster operation, however, so setting the scissor rectangle is not going to help you clip geometry during primitive assembly. You may need to implement additional clipping logic for that purpose. – Andon M. Coleman Oct 01 '13 at 05:31
  • I don't necessarily need a 20,000x20,000 frame buffer, I simply want to preserve the original camera, but only render a small section of that image plane. What I have looked at so far would involve modifying the actual camera to look at that spot. Even if I use the scissor box, how will that help me get around the fact that I will still need a huge framebuffer to preserve the level of detail I want in the area of interest? – Bobby Pardridge Oct 01 '13 at 05:31
  • 1
    I think I may have found the answer, I might want to use this: http://www.opengl.org/sdk/docs/man2/xhtml/gluPickMatrix.xml – Bobby Pardridge Oct 01 '13 at 05:39

2 Answers2

2

All you need to do is to select a different projection matrix. The old reference pages for glFrustum describe how to create such a matrix:

projection matrix

The left, right, top, and bottom parameters specify the edges of your frustum (as shown in your picture). To make a "normal" projection matrix, left = -right, and top = -bottom. Setting them to different values allows you to constrain your view. For instance, if you set left = 0 and top = 0 while leaving right and bottom intact, then you would have a projection similar to the red regions in your picture.

If you figure out the values you are currently using, it should be straightforward to tweak them to produce the result you want.

fintelia
  • 1,201
  • 6
  • 17
1

I think libtr will do what you want.

genpfault
  • 51,148
  • 11
  • 85
  • 139