You can create a pbuffer to render an image larger than the screen.
Use wglGetPixelFormatAttribivEXT with the WGL_MAX_PBUFFER_WIDTH_ARB,
WGL_MAX_PBUFFER_HEIGHT_ARB, or WGL_MAX_PBUFFER_PIXELS_ARB
parameters to ask for maximum possible size.
(see reference doc on
http://oss.sgi.com/projects/ogl-sample/registry/ARB/wgl_pbuffer.txt)
Under windows for ex, here is a quick and dirty paste from my code :
-----------------------------------
/* initialise extensions proc */
wglCreatePbufferARB = (PFNWGLCREATEPBUFFERARBPROC) wglGetProcAddress(
"wglCreatePbufferARB" );
if (wglCreatePbufferARB == NULL) exit(-3);
wglGetPbufferDCARB = (PFNWGLGETPBUFFERDCARBPROC) wglGetProcAddress(
"wglGetPbufferDCARB" );
if (wglGetPbufferDCARB == NULL) exit(-3);
wglChoosePixelFormatARB = (PFNWGLCHOOSEPIXELFORMATARBPROC)
wglGetProcAddress( "wglChoosePixelFormatARB" );
if (wglChoosePixelFormatARB == NULL) exit(-3);
wglBindTexImageARB = (PFNWGLBINDTEXIMAGEARBPROC) wglGetProcAddress(
"wglBindTexImageARB" );
if (wglBindTexImageARB == NULL) exit(-3);
wglReleaseTexImageARB = (PFNWGLRELEASETEXIMAGEARBPROC)
wglGetProcAddress( "wglReleaseTexImageARB" );
if (wglReleaseTexImageARB == NULL) exit(-3);
wglReleasePbufferDCARB = (PFNWGLRELEASEPBUFFERDCARBPROC)
wglGetProcAddress( "wglReleasePbufferDCARB" );
if (wglReleasePbufferDCARB == NULL) exit(-3);
wglDestroyPbufferARB = (PFNWGLDESTROYPBUFFERARBPROC) wglGetProcAddress(
"wglDestroyPbufferARB" );
if (wglDestroyPbufferARB == NULL) exit(-3);
hDC = wglGetCurrentDC();
hRC = wglGetCurrentContext();
UINT nbformats=0;
const int hdcAttributes [30]={
WGL_SUPPORT_OPENGL_ARB, TRUE, // pbuffer will be used with gl
WGL_BIND_TO_TEXTURE_RGB_ARB ,TRUE,
WGL_DRAW_TO_PBUFFER_ARB ,TRUE,
// WGL_DRAW_TO_WINDOW_ARB ,TRUE,
WGL_COLOR_BITS_ARB , 24,
// WGL_ALPHA_BITS_ARB , 8,
WGL_DEPTH_BITS_ARB ,24,
// WGL_STENCIL_BITS_ARB ,8,
WGL_ACCELERATION_ARB,WGL_FULL_ACCELERATION_ARB,
0 };
int *pixelformats=(int*)calloc(256,4);
wglChoosePixelFormatARB(hDC, hdcAttributes,
NULL,
256,
pixelformats,
&nbformats
);
printf("nbformats:%d\n",nbformats);
const int pbufferAttributes [50] = {
// WGL_TEXTURE_FORMAT_ARB,WGL_TEXTURE_RGBA_ARB,
WGL_TEXTURE_FORMAT_ARB,WGL_TEXTURE_RGB_ARB, // use it only for
RenderToTexture, not ctsi
WGL_TEXTURE_TARGET_ARB,WGL_TEXTURE_2D_ARB , // use it only for
RenderToTexture, not ctsi
// WGL_MIPMAP_TEXTURE_ARB,TRUE, // to have nice and fast mipmaps
0
};
pbuffer = wglCreatePbufferARB(hDC,
pixelformats[0],
pwidth, // can be large
pheight, // can be large
pbufferAttributes);
hpbufdc = wglGetPbufferDCARB( pbuffer );
hpbufglrc = wglCreateContext( hpbufdc);
if (pbuffer==NULL) exit(-3);
if (glGetError()!=GL_NO_ERROR) exit(-3);
wglMakeCurrent(
hpbufdc, // device context of device that OpenGL calls are to be drawn on
hpbufglrc // OpenGL rendering context to be made the calling
thread's current rendering context
);
/*************
do your GL drawing on the pbuffer here
***/
// go back to normal onscreen context
wglMakeCurrent(
hDC, // device context of device that OpenGL calls are to be drawn on
hRC // OpenGL rendering context to be made the calling thread's
current rendering context
);