Fix: get bgl methods working with buffer objects
Needs ReviewPublic

Authored by Thomas Szepe (hg1) on Dec 8 2016, 1:00 PM.

Details

Summary

To get the below list of BGL methods working with buffer objects (VBO,
IBO), we need to pass the last parameter also as an integer value.

glColorPointer
glDrawElements
glDrawRangeElements
glEdgeFlagPointer
(glFogCoordPointer)
glIndexPointer
glInterleavedArrays
glNormalPointer
(glSecondaryColor)
glTexCoordPointer
glVertexPointe
glVertexAttribPointer

Diff Detail

Thomas Szepe (hg1) retitled this revision from to Fix: get bgl methods working with buffer objects.Dec 8 2016, 1:00 PM
Thomas Szepe (hg1) updated this object.
source/blender/python/generic/bgl.c
1025

Could you explain the goal/difference of this new macro wrapper ?

source/blender/python/generic/bgl.c
1025

The difference to BGL_Wrap is that BGL_Wrap2 has check for to arg_list.
If the first argument list can be parsed successfully the arg_list types (in this case the integer = GLvuint (void *)integer) will be used for the OpenGL function.
If not the second argument list arg_list2 (in this case the original bgl.Buffer = GLvoidP) wil be used.

@ Aaron Carlisle.
Why you have edited the tags? The BGL wrapper is is for both BGE and Blender.
Also why you have removed Campbell from the reviewer list. He is the Python API module owner.
https://wiki.blender.org/index.php/Dev:Doc/Process/Module_Owners/List

https://developer.blender.org/P450

@Thomas Szepe (hg1) : I used the O&python parsing to call a special function checking between the buffer conversion and the integer conversion. It avoids using a second function wrapper doing a lazy check by clearing the conversion error.

This special conversion is owned by a type named GLaddr for all the addresses coming from a buffer or an offset of a current bound VBO.

@Thomas Szepe (hg1) : What do you think about this ?

I am sorry for the late response. I don't check my email last time.
Your solution is better than my. I also tried to do the same but I don't found a way to add a check function to the parameter reference macro.

Actually I don't have tested it. But I think you have already done it.