utils

Various utility functions for the gl module.

arcade.gl.utils.data_to_ctypes(data: Any) tuple[int, Any][source]

Attempts to convert the data to ctypes if needed by using the buffer protocol.

  • bytes will be returned as is

  • Tuples will be converted to array

  • Other types will be converted to ctypes by using the buffer protocol by creating a memoryview and then a ctypes array of bytes.

Parameters:

data – The data to convert to ctypes.

Returns:

A tuple containing the size of the data in bytes and the data object optionally converted to ctypes.