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

查看:26
本文介绍了如何使用 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 空指针,它可以通过:

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天全站免登陆