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

Mike Erwin significant.bit at gmail.com
Tue Mar 1 20:59:24 CET 2016


I'm not sure about the Python interface, but a zero offset for
glVertexAttribPointer means "from the beginning", not "no offset". So None
does not make sense here. Offset could be made 0 by default since that's a
pretty common case.

Since Blender uses VBOs mostly and is moving more toward that direction
this should be an unsigned integer offset in the API. The old
interpretation of a main-memory pointer will be going away.

Mike Erwin
musician, naturalist, pixel pusher, hacker extraordinaire

On Mon, Feb 29, 2016 at 2:26 AM, Quentin Wenger <matpi at protonmail.ch> wrote:

> 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
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> http://lists.blender.org/mailman/listinfo/bf-committers
>


More information about the Bf-committers mailing list