tags:

views:

125

answers:

4

I'm making an application that draws shapes and I use a camera to draw in other places. Basically, let's say I have a 4x3 rectangle and would like to use glgetpixels to get all the pixels for something that is 1024x768, but my monitor might not support that resolution. How can I render something bigger than the monitor. I do this so I can let the user save a picture of the shapes at an arbitrary resolution. Would using glviewport extend beyond the frame then I can just do glgetpixels?

Thanks

+2  A: 

I am not an OpenGL developer but you definitely can perform rendering to a texture that can have bigger dimensions than the screen.

A google search gave me this, perhaps it is useful: http://developer.nvidia.com/attach/6725

dark_charlie
+2  A: 

This is not a thorough answer, but it should be useful. You're doing RTT, Render to Texture. You're going to set up a new renderbuffer, set that as your render target, and then use glGetPixels to get its value. When you make the renderbuffer with:

void glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);

You can set its size, which doesn't have to match your screen's. Hopefully this helps!

Perrako
+3  A: 

You can RTT (render-to-texture) by defining a FBO (Frame Buffer Object) and attaching a texture to it. Check glBindFramebufferEXT().

And after drawing the scene you are able to execute glGetTexImage() and retrieve the pixels for it.

RTT is a very well established and documented technique.

karlphillip
A: 

Actually, it depends. I think FBOs won't solve your problems (it will help though).

I suspect you're trying to create a high-res version of a 3D scene, for instance to print it at 300dpi. You'll probably need more than your max FBO resolution (4096*4096 on a decent graphic card), so you'll have to use tiled rendering.

The idea is to render your final image as a set of sub-images (tiles)

The author of Mesa3d has written a good library that does this, TR. Usage is quite straightforward.

Calvin1602