开发者

Can OpenGL ES render into CPU memory?

开发者 https://www.devze.com 2023-03-23 00:18 出处:网络
Is it开发者_如何学JAVA possible to render all of the OpenGL ES things into a normal allocated buffer instead of the framebuffer:

Is it开发者_如何学JAVA possible to render all of the OpenGL ES things into a normal allocated buffer instead of the framebuffer:

/* render into this buffer */
GLubyte* buffer =
(GLubyte*) calloc(width * height * 4, sizeof(GLubyte));

I want to be able to convert those rendered images into textures for other uses.

I'm using OpenGL ES 1.3 with the standard C API.


For this you won't get around a call to glReadPixels, which copies the content of the framebuffer into system memory. But when you want to copy it into a texture you can do this directly using glCopyTex(Sub)Image2D or by using FBOs and rendering directly into the texture without the need for a copy (but I'm not sure if FBOs are supported in ES). But of course, you cannot render directly into system memory (for textures it works using FBOs, as they are stored in GPU memory).

0

精彩评论

暂无评论...
验证码 换一张
取 消