I'm trying to create OpenGL bindings for Node. Because of the sheer size of the OpenGL API, doing this manually is impractical, so I turned to Khronos' OpenGL registry.
The files that are provided are easy enough to parse, but there seems to be an important piece missing, and that's how to compute the size of non-trivial parameter buffers.
Here's an example of a function definition that needs such an output buffer. Notice the COMPSIZE() expression:
GetTextureImageEXT(texture, target, level, format, type, pixels)
return void
param texture Texture in value
param target TextureTarget in value
param level CheckedInt32 in value
param format PixelFormat in value
param type PixelType in value
param pixels Void out array [COMPSIZE(target/level/format/type)]
category EXT_direct_state_access
dlflags notlistable
glxflags ignore ### client-handcode server-handcode
extension soft WINSOFT
glfflags capture-execute capture-handcode decode-handcode pixel-pack
This example illustrates the problem well. It seems clear that the "pixels" parameter needs an output buffer whose size depends on the target, level, format and type parameters. But how or where can I find the actual formula to compute that size?
The only piece of related information I could find online was a C source file called compsize.c that apparently belongs to the Apple implementation of OpenGL.
Can anyone help me find the hard data on this?