Windowless OpenGL

Is there any way to access OpenGL functionality without having to create a window? For example, I would want to send data to a graphics card, perform computations and read back the results. If I were to make this a library, I would not want to have a window pop up.

Make a hidden window and render to a pBuffer.

Pbuffers are for offscreen accelerated rendering. However, You need a DC to set a pixel format and everything, so how do you get it?

You do not have to create a window to get one.

Something like this may work:

HDC hDeskDC = GetDC(GetDesktopWindow());
HPBUFFER hPB = wglCreatePBufferARB(hDeskDC, pixelformat, x, y, NULL);
HDC hDC = wglGetPBufferDCARB(hPB);
HGLRC hRC = wglCreateContext(hDC);
wglMakeCurrent(hDC, hRC);

wglMakeCurrent(NULL, NULL);

My knowledge of GDI and the pixel buffer extention is not perfect, so I may be leaving something obvious out.

The value of the pixelformat variable will have to be selected using the WGL_ARB_pixel_format extension.

[This message has been edited by Nakoruru (edited 12-09-2002).]