Render buffer to texture

I’m using glFramebufferTexture2D() to render a buffer to a texture, but that causes it not to display on the screen. How can I write to the texture and to the screen at the same time?

You can’t. You render to the texture, then render (or blit) the texture to the screen afterwards. Or render to the texture then render to the screen afterwards.

How do you do that? Right now I’m just making a copy of the texture.

glBlitFramebuffer(). See this. Note that you can’t always take this approach depending on the format differences between your texture and the system framebuffer and/or your needs for resizing the texture in the blit.

Or as GClements said, you can just render the texture to the screen in the normal way you render with textures. For instance, draw a textured quad.