[racket] question on OpenGL support

From: Jay Kominek (kominek at gmail.com)
Date: Mon Apr 11 17:03:47 EDT 2011

On Mon, Apr 11, 2011 at 1:32 PM, Stephan Houben <stephanh at planet.nl> wrote:
> This function fills array "params" with some data.
> The length of params depends on pname and is not directly specified.
>
> I now wrap this as follows:
>
> (_fun (target : _int32) (level : _int32) (pname : _int32) (params :
> _pointer) -> _void)
>
> So params is just a raw pointer. I should perhaps use _i32vector in "output"
> mode instead but:
> 1. I don't have an expression for the length, and

If you look in enum.spec, and find either of the sections starting
with "passthru: /* GetPName */", all of the lines below look like:
	CURRENT_COLOR					= 0x0B00 # 4 F	# GetPName
	CURRENT_INDEX					= 0x0B01 # 1 F	# GetPName
	CURRENT_NORMAL					= 0x0B02 # 3 F	# GetPName

The number and letter immediately following the enum's value _appear_
to always correspond to the number (and type) of values which that
pname will produce. Kind of distasteful grabbing a value from what
looks like a comment, but they seem to be consistent about it.

> 2. I don't want to have the wrapper allocate and return an array; rather I
> want to mirror
>   the C api exactly and pass in an array which is filled by the function.
>
> The latter I consider especially important, since it ensures that all the
> docs for the C API can be used directly.

PyOpenGL does exactly what you don't want to do, and I think the
normal documentation remains just as useful. I'd certainly prefer that
behavior.

-- 
Jay Kominek



Posted on the users mailing list.