如何制作未装箱的浮点数组,我可以获取 Ptr

发布于 2024-08-15 05:25:35 字数 95 浏览 3 评论 0原文

我正在尝试使用 HopenGL 做一些工作,我需要一个指向浮点数组的 Ptr。从我读到的内容来看,uarray 和 storageArray 似乎是可行的方法,以某种方式组合。

I am trying to do some work with HopenGL and I need a Ptr that points to a array of floats. From what I have read uarray and storableArray seem to be the way to go, in some combination some way.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

老娘不死你永远是小三 2024-08-22 05:25:35

您没有说明您是否已经有一个数组并需要一个指向它的指针,或者您想要创建一个数组。

如果您需要创建一个数组然后获取指向它的指针,那么您确实可以使用可存储数组。为了创建它,请使用 Data.Array.MArray 定义的类和辅助函数。 StorableArrayMArray 类的实例,因此所有这些函数都可用于创建和操作数组。当您想要将 Ptr 获取到数组时,请使用 withStorableArray 函数。

我希望这适合您的用例。

You don't say whether you already have an array and need a pointer to it or you want to create one.

If you need to create an array and then get a pointer to it you can indeed use storable arrays. In order to create it, use the classes and helperfunctions defined Data.Array.MArray. StorableArray is an instance of the MArray class so all those function can be used to create and manipulate the array. When you want to get the Ptr to the array, use the withStorableArray function.

I hope that fits your usecase.

等风来 2024-08-22 05:25:35

如果您使用Storable数组或Foreign数组(在Foreign.*中),您可以获得一个指针来传递给C或朋友。

If you use Storable arrays or Foreign arrays (in Foreign.*) you are able to get a pointer to pass to C or friends.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文