0

I'm trying to render a mesh as depth maps using pyrender, in which it calls glBufferData like this

glBufferData(
        GL_ARRAY_BUFFER, FLOAT_SZ * len(vertex_data),
        vertex_data, GL_STATIC_DRAW
)

However, it throws GL_INVALID_VALUE when the second parameter FLOAT_SZ * len(vertex_data) exceeds the range of GLsizeiptr,

OpenGL.error.GLError: GLError(
        err = 1281,
        description = b'invalid value',
        baseOperation = glBufferData,
        pyArgs = (
                GL_ARRAY_BUFFER,
                2202722400,
                array([ -9.20932  ,   1.6728516, 499.41064  , ...,   1.       ,
         1.       ,   1.       ], dtype=float32),
                GL_STATIC_DRAW,
        ),
(Pdb) GLsizeiptr(2202722400)
c_int(-2092244896)

So is there any way to fix this error?

Nicol Bolas
  • 449,505
  • 63
  • 781
  • 982
  • 1
    @colorfulgreen: This seems to be a bug in pyrender. `GLsizeiptr` is required by the specification to be an integer big enough to store all of the bits of a pointer. Assuming that Python is compiled as a 64-bit application, that would be a 64-bit integer. So pyrender seems to be mangling the value. – Nicol Bolas Jun 18 '23 at 18:36

0 Answers0