Hi Dave,

I'm afraid this can't be done from MacRuby at the moment, and that the Objective-C wrapper is the best solution so far.

However, if this is a common OpenGL function, maybe we need to find a solution for 1.0… consider filing a ticket. 

Laurent

On Jan 10, 2011, at 5:42 AM, Dave Baldwin wrote:

In OpenGL some functions take pointers and these are easily handled via

v = Pointer.new('f', 20)
glVertexPointer(3, GL_FLOAT, 3,  v)

(the C prototype is 
void glVertexPointer(GLint  size, GLenum  type, GLsizei  stride, const GLvoid *  pointer);


however in some cases this function has been overloaded so you pass in an integer as the last parameter.  In C this is easy
glVertexPointer(3, GL_FLOAT, 3, (void *) 12)

but how do I do this with MacRuby Pointer objects?  (the source code and googling hasn't helped).  I can (and have) written this as an objective-C method and called this method from ruby so I have a workaround.  I can understand if this is not possible or desirable from ruby as it is a horrible bit of API design in OpenGL in any case.

Dave.

_______________________________________________
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel