[MacRuby-devel] Porting Cocoa OpenGL sample code

Julien Jassaud julien at collectapply.jp
Wed Feb 25 01:42:35 PST 2009


Hello,

I am trying to port the Cocoa OpenGL sample to MacRuby and encountered  
a few problems.


First, I can't access some constants defined in an enum in GLTypes.h.  
Do I need to port those constants to ruby by hand ? Is that related to  
gen_bridge_metadata ?


Second, I need to use CGLQueryRendererInfo and CGLDescribeRenderer  
functions. The first one requires a pointer to a CGLRendererInfoObj  
structure but the second requires the object to be passed directly. I  
tried some C style pointer arithmetic :

info	= Pointer.new_with_type("CGLRendererInfoObj")
count	= Pointer.new_with_type("l")

CGLQueryRendererInfo(caps[:cgl_display_mask], info, count) <- works  
fine, but CGLRendererInfoObj is opaque so I can't check it in irb.

CGLDescribeRenderer(info[0], 0, kCGLRPRendererCount, count) <- I  
naively tried to dereference the pointer, but it doesn't work.

CGLDescribeRenderer(info, 0, kCGLRPRendererCount, count) <- No  
complaints, but the value for count[0] is not consistent (100468704  
renderers).

I see in MacIRB that there is a CGLRendererInfoObj class but I can't  
instantiate it.

This is all new to me and I may be overlooking something obvious. If  
anyone has an idea, please help.

Thanks,
Julien Jassaud
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20090225/2dd01d01/attachment-0001.html>


More information about the MacRuby-devel mailing list