Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I'll assume that creating a dummy window (you don't render to it; it's just there because the API requires you to make one) that you create your main context into is an acceptable implementation strategy.</p> <p>Here are your options:</p> <h2>Pixel buffers</h2> <p>A pixel buffer, or pbuffer (which isn't a <a href="http://www.opengl.org/wiki/Pixel_Buffer_Object" rel="noreferrer">pixel buffer object</a>), is first and foremost an <em>OpenGL context</em>. Basically, you create a window as normal, then pick a pixel format from <a href="http://www.opengl.org/registry/specs/ARB/wgl_pixel_format.txt" rel="noreferrer"><code>wglChoosePixelFormatARB</code></a> (pbuffer formats must be gotten from here). Then, you call <code>wglCreatePbufferARB</code>, giving it your window's HDC and the pixel buffer format you want to use. Oh, and a width/height; you can query the implementation's maximum width/heights.</p> <p>The default framebuffer for pbuffer is not visible on the screen, and the max width/height is whatever the hardware wants to let you use. So you can render to it and use <code>glReadPixels</code> to read back from it.</p> <p>You'll need to share you context with the given context if you have created objects in the window context. Otherwise, you can use the pbuffer context entirely separately. Just don't destroy the window context.</p> <p>The advantage here is greater implementation support (though most drivers that don't support the alternatives are also old drivers for hardware that's no longer being supported. Or is Intel hardware).</p> <p>The downsides are these. Pbuffers don't work with <a href="http://www.opengl.org/wiki/Core_And_Compatibility_in_Contexts" rel="noreferrer">core OpenGL contexts</a>. They may work for compatibility, but there is no way to give <code>wglCreatePbufferARB</code> information about OpenGL versions and profiles.</p> <h2>Framebuffer Objects</h2> <p><a href="http://www.opengl.org/wiki/Framebuffer_Object" rel="noreferrer">Framebuffer Objects</a> are more "proper" offscreen rendertargets than pbuffers. FBOs are within a context, while pbuffers are about creating new contexts.</p> <p>FBOs are just a container for images that you render to. The maximum dimensions that the implementation allows can be queried; you can assume it to be <code>GL_MAX_VIEWPORT_DIMS</code> (make sure an FBO is bound before checking this, as it changes based on whether an FBO is bound).</p> <p>Since you're not sampling textures from these (you're just reading values back), you should use renderbuffers instead of textures. Their maximum size may be larger than those of textures.</p> <p>The upside is the ease of use. Rather than have to deal with pixel formats and such, you just pick an appropriate <a href="http://www.opengl.org/wiki/Image_Format" rel="noreferrer">image format</a> for your <code>glRenderbufferStorage</code> call.</p> <p>The only real downside is the narrower band of hardware that supports them. In general, anything that AMD or NVIDIA makes that they still support (right now, GeForce 6xxx or better [note the number of x's], and any Radeon HD card) will have access to ARB_framebuffer_object or OpenGL 3.0+ (where it's a core feature). Older drivers may only have EXT_framebuffer_object support (which has a few differences). Intel hardware is potluck; even if they claim 3.x or 4.x support, it may still fail due to driver bugs.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload