如何使用PyOpenGL指定缓冲区偏移 [英] How to specify buffer offset with PyOpenGL

查看:99
本文介绍了如何使用PyOpenGL指定缓冲区偏移的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

与PyOpenGL等效的是什么

What is the PyOpenGL equivalent of

#define BUFFER_OFFSET(i) (reinterpret_cast<void*>(i))

glDrawElements(GL_TRIANGLE_STRIP, count, GL_UNSIGNED_SHORT, BUFFER_OFFSET(offset))

如果偏移量为0,则

glDrawElements(GL_TRIANGLE_STRIP, count, GL_UNSIGNED_SHORT, None)

可以,但是我不知道如何在缓冲区对象中指定非零偏移量.

works, but I can not figure out how to specify a non-zero offset into a buffer object.

推荐答案

您应该传递一个ctypes void指针,该指针可以通过以下方式构造:

You're supposed to pass a ctypes void pointer, which can constructed by :

ctypes.c_void_p(offset)

使用VBO类似乎有一个更特定于PyOpenGL的选项,并且根据

There seems to be a more PyOpenGL specific option using a VBO class, and gotcha with some versions of PyOpenGL according to this.

这篇关于如何使用PyOpenGL指定缓冲区偏移的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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