如何在Android中使用OpenGL共享Renderscript分配分配、如何在、OpenGL、Android

由网友(最后的深情)分享简介:我有一个Renderscript其处理是给予在输出到分配的图像。我想用这个分配作为纹理在我的OpenGL程序,但我不知道怎么去从分配纹理ID。I have a Renderscript which processes an image that is given in output to an Allocation...

我有一个Renderscript其处理是给予在输出到分配的图像。 我想用这个分配作为纹理在我的OpenGL程序,但我不知道怎么去从分配纹理ID。

I have a Renderscript which processes an image that is given in output to an Allocation. I want to use this Allocation as a texture in my OpenGL program but I don't know how to get a texture ID from the Allocation.

在另一方面,我知道我可以使用一个图形Renderscript,但既然已经去precated,我想一定要达到相同的结果一些其他的方式。

On the other hand, I know I could use a graphic Renderscript, but since it has been deprecated, I guess there must be some other way to achieve the same result.

推荐答案

指定USAGE_IO_OUTPUT当您创建的分配。假设您正在生成的纹理数据的脚本,你还要补充USAGE_SCRIPT。然后,您可以调用

Specify USAGE_IO_OUTPUT when you create the Allocation. Assuming you are generating the texture data in a script you would also add USAGE_SCRIPT. You can then call

Allocation.setSurface(theGLSurface)

Allocation.setSurface(theGLSurface)

要分配链接到一个纹理。每当你想更新你需要调用脚本的内容质感。

to link the allocation to a texture. Each time you want to update the texture with the contents of the script you need to call.

Allocation.ioSend()

Allocation.ioSend()

这将移动数据,而无需做额外的拷贝。

This will move the data without making extra copies.

阅读全文

相关推荐

最新文章