在获取 FBO 纹理之前,如何确保帧缓冲区已经写入?

How can I make sure the frame buffer has already been written before I fetch the FBO texture?

Three.js RTT sample中,代码是这样的:

renderer.render( sceneRTT, cameraRTT, rtTexture, true );

// Render full screen quad with generated texture
renderer.render( sceneScreen, cameraRTT );

如何在实际获取renderer.render( sceneScreen, cameraRTT );中的rtTexture数据之前确保rtTexture已经写入?

你不需要检查。它将在您获取之前呈现。 WebGL 像所有 OpenGL 一样按顺序发生。来自 the spec

Chapter 2

OpenGL ES Operation

2.1 OpenGL ES Fundamentals

...

Commands are always processed in the order in which they are received, although there may be an indeterminate delay before the effects of a command are realized. This means, for example, that one primitive must be drawn completely before any subsequent one can affect the framebuffer. It also means that queries and pixel read operations return state consistent with complete execution of all previously invoked GL commands. In general, the effects of a GL command on either GL modes or the framebuffer must be complete before any subsequent command can have any such effects.

同样的段落也在the OpenGL spec