简体   繁体   中英

glCopyTexImage2D as alternative to glReadPixels (OpenGL ES)

I'm currently grabbing a screenshot of an OpenGL ES game using glReadPixels . The screenshots are great however the call to glReadPixels causes a small stutter in the game.

glCopyTexImage2D has been suggested as a more efficient replacement for glReadPixels . How does glCopyTexImage2D work? For some context I'm using this Apple method .

I'm relatively new to OpenGL so any help is much appreciated :-)

The time delay is caused by transferring a large amount of memory between GPU and CPU. This can be solved by transferring in chunks, a little bit per frame. But if you read from the framebuffer over a series of frame, the image would be changing meanwhile.

So you make a copy, video RAM into video RAM (very fast), and then it won't change as you transfer it piecemeal.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM