[Bf-committers] NULL-like bgl.Buffer and related

Quentin Wenger matpi at protonmail.ch
Mon Feb 29 08:26:54 CET 2016


Hi,

[not sure this best belongs to bf-committers or bf-python...]

I am currently developping an addon making heavy use of OpenGL/bgl (and BTW gpu.offscreen, which seems to do exactly what I was lacking for in terms of Framebuffers... thanks Dalai & reviewers!).

Still there is one only thing that seems not to work for me: bgl.glVertexAttribPointer. Reason for that is, I would use (void*)0 (or NULL maybe) as the last parameter in equivalent OpenGL/C code, that last parameter representing an offset in the buffer, which seems not to be possible currently with bgl.Buffer.

So I thought I'd need to implement a kind of special bgl.Buffer (maybe stored as a variable in bgl or even, static in bgl.Buffer) internally mapping to (void*)0 or NULL. But then I realized it could sometimes be helpful to specify other offsets, say (void*)4, etc.

At this point I decided it would be better to ask more people before diving in the code. ;-)

So, what do you think about that? Do you know about a workaround in bgl? Is the implementation of special bgl.Buffer a possibility?

Note that I do have a temporary workaround - OpenGL.GL.glVertexAttribPointer(..., ctypes.c_void_p(None)) in the middle of bgl code - but that's not very nice, uses external package, etc. Moreover, without such as special bgl.Buffer or any similar alternative the function bgl.glVertexAttribPointer simply is mostly useless.

Thanks,
Quentin


More information about the Bf-committers mailing list