Is it able to directly write to GL_BACK as texture?

is it able to directly write to GL_BACK as texture? and able to use GL_BACK as textureUnitID?
GL_BACK is the default colorAttachment of the default frameBuffer.

No. Directing rendering output to a texture requires the use of framebuffer objects (FBOs). These use GL_COLOR_ATTACHMENT0 etc whereas GL_BACK, GL_BACK_LEFT etc can only be used with the default (physical) framebuffer. See glDrawBuffers.

To maximize your chance of getting useful feedback, it would help if you provided context for what you’re trying to do, why, and what you’ve tried.

See The Forum Posting Guidelines for tips in writing your response.

trying to directly write to the default framebuffer’s GL_BACK from CUDA in order to minimize the memory size and the counts of memcpy both in host and deive.
Thanks

Thanks!
so GL_BACK, GL_BACK_LEFT, etc, those 4 or 6 default colorAttachment are use when not offScreen rendering, right? is there any other usage of them?
Moreover, i remember nowadays most engines donot use GL_BACK them at all, they create and manage their on FBOs, eg. 2 FBO and 1 of them for display. Right?

There’s no other way (than GL_BACK etc) to actually get the image onto the physical screen using only standard OpenGL. It’s likely possible using EGL or some platform-specific API.

Sure you can. Just allocate the GL context/window for the default framebuffer in single-buffered visual/pixel format/FBconfig and use GL_FRONT. Whether this is displayed directly or buffered by some compositing window manager, and under what specific use cases, is window system specific. Some won’t provide this at all.

Though this is somewhat of an aside to the original question:

Assuming you really do need the absolute min number of memory block transfers, then GL_BACK + double buffer is probably fine. You likely don’t want tearing. Also, buffer swap for double-buffer can just be a pointer change and not involve any memory copies. Finally, look into how you can bypass (skip) the memcpys and intermediate rendering typically performed for a window by a window manager running on your system. Some terms to search for are full-screen exclusive, flip presentation mode, etc. Best case: You’re rendering to the full-screen image which will be scanned out directly to the video output after the next buffer swap. Minimum memory transfers.

When I said “etc”, I was referring to any of the buffers of the default framebuffer.

OP seemed to be suggesting that there was some mechanism involving FBOs, and there isn’t (at least not with vanilla OpenGL; some platforms might allow you to use EGL or some platform-specific API to turn the physical framebuffer into something which functions as an OpenGL texture).

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.