如何在Android中使用OpenGL共享Renderscript分配 [英] How to share a Renderscript allocation with OpenGL in Android

查看:309
本文介绍了如何在Android中使用OpenGL共享Renderscript分配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个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.

这篇关于如何在Android中使用OpenGL共享Renderscript分配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆