[MacRuby-devel] KVO dot notation bug?
I may have come across a KVO-related bug in MacRuby. In my project I
have an Objective-C subclass of NSObject that uses @property and
@synthesize to set up instance variable accessors.
In the init method I set a key-value observer for one of those
variables ('text') using:
[self addObserver:self forKeyPath:@"text"
options:NSKeyValueObservingOptionNew context:NULL];
The class also has the required observing method:
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object
change:(NSDictionary *)change context:(void *)context
When I set a new value for 'text' from Objective-C code using
something like instance.text = @"Hello", the observing method is
called as expected and everything is fine.
When I set a new value from MacRuby code using
instance.setText("Hello"), it also works fine.
However, when I set a new value from MacRuby code using dot notation,
e.g. instance.text = "Hello", it fails and the debugger is activated.
The error log is lengthy, but it begins with these statements:
warning: Could not find object file "/private/tmp/trunk/array.o" - no
debug information available for "array.c".
warning: Could not find object file "/private/tmp/trunk/bignum.o" - no
debug information available for "bignum.c".
Assigning values to the other instance variables of the Obj-C class
works fine from MacRuby using dot notation, but those other variables
do not have observers assigned. In fact, if I remove the
'observeValue...' method from the Obj-C class, the dot notation
assignment works fine again for that 'text' variable.
Sure seems like a bug to me. Any ideas?
Jim
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
[MacRuby-devel] Exposing c structs and functions
Is there a way to expose some c structs and functions from a custom
Objective-C framework to MacRuby?
For instance, in my framework I have a 3-D point struct, such as:
typedef struct {
CGFloat x, y, z;
} JPoint3;
In addition, I have creation functions such as 'JPoint3Make(x, y, z)'
etc.
How do I make these usable from MacRuby, like NSPoint and NSMakePoint
are?
Jim
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
Re: [MacRuby-devel] Exposing c structs and functions
John, thanks for the ideas. Currently, I am using a simple Obj-C class with methods instead of a struct and functions. That works OK, but it is not the best solution, especially in those cases where the framework would be used by Obj-C code instead of MacRuby code and where speed is a concern. A struct/ function approach is really ideal. I am afraid I don't understand the tutorial example concerning BridgeSupport files and how that might apply to structs and functions. As you said, the documentation on the BridgeSupport web page is limited. Before I go down that road, I'd love to know how involved the process is, see an example of how it works, and so on. Perhaps Laurent could shed some light? Jim ___ MacRuby-devel mailing list [email protected] http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
Re: [MacRuby-devel] Exposing c structs and functions
OK, I decided to devote a little time to see if I could make any
headway with BridgeSupport. It doesn't seem too terribly complicated,
but I have run into a problem.
My framework is called ZenGL, so I first created a struct in ZenGL.h
based on NSPoint:
typedef struct _ZPoint {
float x;
float y;
} ZPoint;
I also created a ZPointMake function:
ZPoint ZPointMake(float x, float y);
Then, I rebuilt the framework. Fine so far.
Next, I created an XML ZenGL.bridgesupport file using Foundation.xml
(in /Library/BridgeSupport/) as an example. Here are the contents:
">
encoding='{_ZPoint="x"f"y"f}'
type='{_ZPoint="x"f"y"f}'/>
I placed ZenGL.bridgesupport in the folder with my built MacRuby app
and added this code to load it:
load_bridge_support_file './ZenGL.bridgesupport'
(Going back to my xml, I originally did not include a 'type' attribute
for the struct since the NSPoint example in Foundation.xml did not
have one, but I received an error when running the load_... command.
Not sure why.)
All seems well, but when I try this code from MacRuby:
zp = ZPointMake(10.0, 10.0)
I get this error:
`ZPointMake': wrong number of arguments (2 for 0) (ArgumentError)
My ZPointMake function definition in the xml sure looks right to me,
based on the examples in Foundation.xml, so what have I done wrong?
Jim
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
Re: [MacRuby-devel] Exposing c structs and functions
Hi Laurent,
First, why does the Foundation.xml use the elements "function_retval"
and "function_arg" instead of just "retval" and "arg"?
Second, I used the xml you suggested, but I now get this error:
`ZPointMake': unrecognized octype `{_ZPoint="x"f"y"f}' (RuntimeError)
I have read the man pages (I had to learn what a "man page" was
first!), but I didn't see anything that would solve that error.
Thanks for your help,
Jim
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
Re: [MacRuby-devel] Exposing c structs and functions
Laurent, OK, it has taken me awhile to get back to this issue again, but yes, you were exactly right, I needed to look at the newer BridgeSupport format in /System/Library/Frameworks... It works great now. Thanks for the help! Jim Hi Jim, You're probably looking at an old BridgeSupport file. function_retval and function_arg do not exist anymore since a very long time, and were replaced by retval and arg. You should be able to get the latest Foundation bridgesupport file from here: /System/Library/Frameworks/Foundation.framework/Resources/ BridgeSupport/Foundation.bridgesupport Back to your new problem, I think your struct element is also wrong (uses the old definition). I would look at the Foundation file and try to mimic it. Also, you can generate the file by using gen_bridge_metadata (from the command line) if your code is a framework or a shared library. Finally, if you opt by writing the file by yourself, it is always good to run an XML validation pass (the DTD location is part of your XML declaration). Laurent ___ MacRuby-devel mailing list [email protected] http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
[MacRuby-devel] What's going on with MacRuby?
Development seems to have slowed to a crawl, as has the mailing list activity. Has RubyMotion has sucked all the oxygen away from MacRuby? Or perhaps the main contributors are just busy right now? Can anyone share some insight? ___ MacRuby-devel mailing list [email protected] http://lists.macosforge.org/mailman/listinfo/macruby-devel
Re: [MacRuby-devel] What's going on with MacRuby?
Josh, The recent Github activity is nice to see, and your point about MacRuby being fairly mature is well-taken. When I saw that Watson joined the RubyMotion team, saw the commits slow down, and noticed the lack of mailing list activity (especially compared to the RubyMotion Google group activity), I got a little worried. I'm putting a fair amount of time into some MacRuby projects, I love it, and I want to see it thrive. Aside from that broad concern, I have experienced only one particular issue, for which I filed a bug report (#137). It's no biggie, and I certainly don't expect anybody to jump on it, since it's pretty low in priority. Hopefully, we will see some of the RM code (such as the memory management model) make it back into the MR code. Jim On Sep 28, 2012, at 11:02 AM, Joshua Ballanco wrote: Hi Jim, I can only speak for myself, but moving (to another continent even), starting a new job, and having a new baby would, I think, qualify as busy! ;-) Admittedly the mailing list activity has dropped off a bit, but I do still and try to monitor #macruby on Freenode and the GitHub project has a decent amount of activity. One would hope that the other reason activity has dropped off is that people are having fewer issues with MacRuby. Now, that may be wishful thinking, but if there is something in particular you are concerned about I think we'd be more than happy to hear about it and discuss what could be done. Cheers, Josh On Saturday, September 22, 2012 at 5:29 PM, Jim Getzen wrote: > Development seems to have slowed to a crawl, as has the mailing list activity. > > Has RubyMotion has sucked all the oxygen away from MacRuby? Or perhaps the > main contributors are just busy right now? > > Can anyone share some insight? > ___ > MacRuby-devel mailing list > [email protected] > http://lists.macosforge.org/mailman/listinfo/macruby-devel ___ MacRuby-devel mailing list [email protected] http://lists.macosforge.org/mailman/listinfo/macruby-devel ___ MacRuby-devel mailing list [email protected] http://lists.macosforge.org/mailman/listinfo/macruby-devel
Re: [MacRuby-devel] Quartz 2D Graphics problem
A fairly recent project of mine makes the exact same context call in drawRect.
I just ran it again without a problem. My MacRuby is one of the nightlies from
2-3 weeks ago.
Jim
On Oct 18, 2012, at 12:30 AM, Robert Carl Rice wrote:
Hi,
I went back to working on an old project that uses core graphics and I'm having
problems getting it to run again.
The following code gives me an error with the graphics context:
def drawRect( rect )
return unless @controller
begin
@context = NSGraphicsContext.currentContext.graphicsPort
# Scale 15 min intervals to chart area
@xscale = bounds.size.width / 25.0
height = bounds.size.height
@yscale = height / 2.0
CGContextScaleCTM( @context, @xscale, @yscale )
CGContextTranslateCTM( @context, 0.5, 0.5 ) # Indent
from bounds
# restore text size
CGContextSetTextMatrix( @context,
CGAffineTransformMakeScale( 1 / @xscale, 1 / @yscale ))
show_index( height )
rescue => e
ErrorLog.instance.rescue_error( e )
end
end
unrecognized runtime type `{CGContext=}'
/Users/robertrice/Library/Developer/Xcode/DerivedData/MacDriverLog-ebberjlfoqoqdzenjgqkdbkehuoj/Build/Products/Debug/MacDriverLog.app/Contents/Main_Window.bundle/Contents/Resources/RemarksIndexView.rb:55:in
`drawRect'
/Users/robertrice/Library/Developer/Xcode/DerivedData/MacDriverLog-ebberjlfoqoqdzenjgqkdbkehuoj/Build/Products/Debug/MacDriverLog.app/Contents/Resources/rb_main.rb:69:in
`'
line 55 is the first line:
@context = NSGraphicsContext.currentContext.graphicsPort
Has anything changed with regard to Quartz 2D drawing?
Thanks,
Bob Rice
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo/macruby-devel
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo/macruby-devel
Re: [MacRuby-devel] Quartz 2D Graphics problem
Aside from MacRuby and a couple of sound frameworks, it just uses Cocoa,
CoreGraphics, and QuartzCore.
Jim
On Oct 18, 2012, at 7:45 PM, Robert Carl Rice wrote:
Hi Jim,
What frameworks do you included in your project?
Thanks,
Bob Rice
On Oct 18, 2012, at 8:22 AM, Jim Getzen wrote:
> A fairly recent project of mine makes the exact same context call in
> drawRect. I just ran it again without a problem. My MacRuby is one of the
> nightlies from 2-3 weeks ago.
>
> Jim
>
>
> On Oct 18, 2012, at 12:30 AM, Robert Carl Rice wrote:
>
> Hi,
>
> I went back to working on an old project that uses core graphics and I'm
> having problems getting it to run again.
>
> The following code gives me an error with the graphics context:
>
> def drawRect( rect )
> return unless @controller
>
> begin
> @context = NSGraphicsContext.currentContext.graphicsPort
>
> # Scale 15 min intervals to chart area
> @xscale = bounds.size.width / 25.0
> height = bounds.size.height
> @yscale = height / 2.0
> CGContextScaleCTM( @context, @xscale, @yscale )
> CGContextTranslateCTM( @context, 0.5, 0.5 ) # Indent
> from bounds
>
> # restore text size
> CGContextSetTextMatrix( @context,
> CGAffineTransformMakeScale( 1 / @xscale, 1 / @yscale ))
> show_index( height )
>
> rescue => e
> ErrorLog.instance.rescue_error( e )
> end
> end
>
> unrecognized runtime type `{CGContext=}'
> /Users/robertrice/Library/Developer/Xcode/DerivedData/MacDriverLog-ebberjlfoqoqdzenjgqkdbkehuoj/Build/Products/Debug/MacDriverLog.app/Contents/Main_Window.bundle/Contents/Resources/RemarksIndexView.rb:55:in
> `drawRect'
> /Users/robertrice/Library/Developer/Xcode/DerivedData/MacDriverLog-ebberjlfoqoqdzenjgqkdbkehuoj/Build/Products/Debug/MacDriverLog.app/Contents/Resources/rb_main.rb:69:in
> `'
>
> line 55 is the first line:
> @context = NSGraphicsContext.currentContext.graphicsPort
>
> Has anything changed with regard to Quartz 2D drawing?
>
> Thanks,
> Bob Rice
>
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo/macruby-devel
>
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo/macruby-devel
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo/macruby-devel
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo/macruby-devel
Re: [MacRuby-devel] Quartz 2D Graphics problem
Bob,
No, I haven't. Perhaps I will get a chance later.
I have noticed some oddities with AppKit and OpenGL framework bridgesupport
files, but that will have to be the subject of another post.
Jim
On Oct 18, 2012, at 9:50 PM, Robert Carl Rice wrote:
Hi Jim,
Adding those frameworks didn't fix my BridgeSupport problem. Have you tried to
build your project with the most recent nightly build?
Thanks,
Bob Rice
On Oct 18, 2012, at 8:30 PM, Jim Getzen wrote:
> Aside from MacRuby and a couple of sound frameworks, it just uses Cocoa,
> CoreGraphics, and QuartzCore.
>
> Jim
>
>
> On Oct 18, 2012, at 7:45 PM, Robert Carl Rice wrote:
>
> Hi Jim,
>
> What frameworks do you included in your project?
>
> Thanks,
> Bob Rice
>
> On Oct 18, 2012, at 8:22 AM, Jim Getzen wrote:
>
>> A fairly recent project of mine makes the exact same context call in
>> drawRect. I just ran it again without a problem. My MacRuby is one of the
>> nightlies from 2-3 weeks ago.
>>
>> Jim
>>
>>
>> On Oct 18, 2012, at 12:30 AM, Robert Carl Rice wrote:
>>
>> Hi,
>>
>> I went back to working on an old project that uses core graphics and I'm
>> having problems getting it to run again.
>>
>> The following code gives me an error with the graphics context:
>>
>> def drawRect( rect )
>> return unless @controller
>>
>> begin
>> @context = NSGraphicsContext.currentContext.graphicsPort
>>
>> # Scale 15 min intervals to chart area
>> @xscale = bounds.size.width / 25.0
>> height = bounds.size.height
>> @yscale = height / 2.0
>> CGContextScaleCTM( @context, @xscale, @yscale )
>> CGContextTranslateCTM( @context, 0.5, 0.5 ) # Indent
>> from bounds
>>
>> # restore text size
>> CGContextSetTextMatrix( @context,
>> CGAffineTransformMakeScale( 1 / @xscale, 1 / @yscale ))
>> show_index( height )
>>
>> rescue => e
>> ErrorLog.instance.rescue_error( e )
>> end
>> end
>>
>> unrecognized runtime type `{CGContext=}'
>> /Users/robertrice/Library/Developer/Xcode/DerivedData/MacDriverLog-ebberjlfoqoqdzenjgqkdbkehuoj/Build/Products/Debug/MacDriverLog.app/Contents/Main_Window.bundle/Contents/Resources/RemarksIndexView.rb:55:in
>> `drawRect'
>> /Users/robertrice/Library/Developer/Xcode/DerivedData/MacDriverLog-ebberjlfoqoqdzenjgqkdbkehuoj/Build/Products/Debug/MacDriverLog.app/Contents/Resources/rb_main.rb:69:in
>> `'
>>
>> line 55 is the first line:
>> @context = NSGraphicsContext.currentContext.graphicsPort
>>
>> Has anything changed with regard to Quartz 2D drawing?
>>
>> Thanks,
>> Bob Rice
>>
>> ___
>> MacRuby-devel mailing list
>> [email protected]
>> http://lists.macosforge.org/mailman/listinfo/macruby-devel
>>
>> ___
>> MacRuby-devel mailing list
>> [email protected]
>> http://lists.macosforge.org/mailman/listinfo/macruby-devel
>
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo/macruby-devel
>
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo/macruby-devel
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo/macruby-devel
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo/macruby-devel
Re: [MacRuby-devel] Quartz 2D Graphics problem
10.8.2
Jim
On Oct 19, 2012, at 12:18 AM, Mark Rada wrote:
Hey Jim,
What version of OS X are you running things on?
On 2012-10-18, at 9:50 PM, Robert Carl Rice wrote:
> Hi Jim,
>
> Adding those frameworks didn't fix my BridgeSupport problem. Have you tried
> to build your project with the most recent nightly build?
>
> Thanks,
> Bob Rice
>
>
> On Oct 18, 2012, at 8:30 PM, Jim Getzen wrote:
>
>> Aside from MacRuby and a couple of sound frameworks, it just uses Cocoa,
>> CoreGraphics, and QuartzCore.
>>
>> Jim
>>
>>
>> On Oct 18, 2012, at 7:45 PM, Robert Carl Rice wrote:
>>
>> Hi Jim,
>>
>> What frameworks do you included in your project?
>>
>> Thanks,
>> Bob Rice
>>
>> On Oct 18, 2012, at 8:22 AM, Jim Getzen wrote:
>>
>>> A fairly recent project of mine makes the exact same context call in
>>> drawRect. I just ran it again without a problem. My MacRuby is one of the
>>> nightlies from 2-3 weeks ago.
>>>
>>> Jim
>>>
>>>
>>> On Oct 18, 2012, at 12:30 AM, Robert Carl Rice wrote:
>>>
>>> Hi,
>>>
>>> I went back to working on an old project that uses core graphics and I'm
>>> having problems getting it to run again.
>>>
>>> The following code gives me an error with the graphics context:
>>>
>>> def drawRect( rect )
>>> return unless @controller
>>>
>>> begin
>>> @context = NSGraphicsContext.currentContext.graphicsPort
>>>
>>> # Scale 15 min intervals to chart area
>>> @xscale = bounds.size.width / 25.0
>>> height = bounds.size.height
>>> @yscale = height / 2.0
>>> CGContextScaleCTM( @context, @xscale, @yscale )
>>> CGContextTranslateCTM( @context, 0.5, 0.5 ) # Indent
>>> from bounds
>>>
>>> # restore text size
>>> CGContextSetTextMatrix( @context,
>>> CGAffineTransformMakeScale( 1 / @xscale, 1 / @yscale ))
>>> show_index( height )
>>>
>>> rescue => e
>>> ErrorLog.instance.rescue_error( e )
>>> end
>>> end
>>>
>>> unrecognized runtime type `{CGContext=}'
>>> /Users/robertrice/Library/Developer/Xcode/DerivedData/MacDriverLog-ebberjlfoqoqdzenjgqkdbkehuoj/Build/Products/Debug/MacDriverLog.app/Contents/Main_Window.bundle/Contents/Resources/RemarksIndexView.rb:55:in
>>> `drawRect'
>>> /Users/robertrice/Library/Developer/Xcode/DerivedData/MacDriverLog-ebberjlfoqoqdzenjgqkdbkehuoj/Build/Products/Debug/MacDriverLog.app/Contents/Resources/rb_main.rb:69:in
>>> `'
>>>
>>> line 55 is the first line:
>>> @context = NSGraphicsContext.currentContext.graphicsPort
>>>
>>> Has anything changed with regard to Quartz 2D drawing?
>>>
>>> Thanks,
>>> Bob Rice
>>>
>>> ___
>>> MacRuby-devel mailing list
>>> [email protected]
>>> http://lists.macosforge.org/mailman/listinfo/macruby-devel
>>>
>>> ___
>>> MacRuby-devel mailing list
>>> [email protected]
>>> http://lists.macosforge.org/mailman/listinfo/macruby-devel
>>
>> ___
>> MacRuby-devel mailing list
>> [email protected]
>> http://lists.macosforge.org/mailman/listinfo/macruby-devel
>>
>> ___
>> MacRuby-devel mailing list
>> [email protected]
>> http://lists.macosforge.org/mailman/listinfo/macruby-devel
>
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo/macruby-devel
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo/macruby-devel
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo/macruby-devel
Re: [MacRuby-devel] Quartz 2D Graphics problem
You don't need to make a framework or bundle to add Obj-C code to your project.
I've been able to just add a .h/.m files directly to the project and call the
Obj-C classes contained therein from my MacRuby code, just as if those classes
were part of a framework.
What you can't do, of course, is call straight C functions or constants without
a bridgesupport file.
Jim
On Oct 21, 2012, at 12:59 PM, Mark Rada wrote:
Adding some Objective-C code could be done with a framework as suggested, or by
creating a bundle. The bundle process is essentially the same as creating a C
extension for Ruby. Any MacRuby project with a C extension could be used as an
example:
https://github.com/pieter/macruby-bundle-example
https://github.com/Marketcircle/AXElements/tree/master/ext/accessibility/key_coder
https://github.com/alloy/ObjectiveBacon/tree/master/LanguageBindings/MacRuby/ext
You can then simply "require 'bundle'" the bundle file that is compiled.
On 2012-10-21, at 12:44 PM, Colin Thomas-Arnold wrote:
> You can certainly compile a group of stuff as a framework, and add that
> framework to your project, but I've never tried to just toss in .h/.m files
> and access them from macruby.
>
> Can anyone touch on that? I'm interested to hear what can be done there...
>
>
> AFA translating your code into Obj-C...
>
>
> Here's the short version:
>
> self.context = [[NSGraphics currentContext] graphicsPort];
>
>
>
> And here's the long version!
>
>
> // the header file, YourClass.h
>
> @interface YourClass : ParentClass
>
> @property (assign, nonatomic) CGContextRef context;
> // or void* instead of CGContextRef, but graphicsPort returns a CGContextRef
>
> @end
>
>
>
> // the implementation file, YourClass.m
>
> #import "YourClass.h"
>
> @implementation YourClass
>
> @synthesize context;
>
> - drawRect:(CGRect)rect
> {
> self.context = [[NSGraphics currentContext] graphicsPort];
> }
>
> @end
>
>
>
>
> @colinta
> colinta.com
> github.com/colinta
>
>
>
>
> On Oct 21, 2012, at 10:19 AM, Robert Carl Rice wrote:
>
>> Hi Mark,
>>
>> Unfortunately, I am not very familiar with objective C syntax. Is it easy to
>> mix objective C statements with MacRuby?
>> For example, How would code the @context =
>> NSGraphicsContext.currentContext.graphicsPort in objective C?
>>
>> Thanks,
>> Bob Rice
>
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo/macruby-devel
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo/macruby-devel
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo/macruby-devel
Re: [MacRuby-devel] Problem with a window controller
Hi David,
You might check out this Stack Overflow entry to see if it solves your problem:
http://stackoverflow.com/questions/2695671/nswindowcontroller-windowdidload-not-called
Jim
On Nov 29, 2012, at 6:50 PM, david kramf wrote:
Hi,
In the copied below code only the awakeFromNib is executed . Can someone
explain me what do I do wrong ? Window is displayed and I expected all other
methods to be called.
Thanks, David
class MyController < NSWindowController
attr_accessor :window
def awakeFromNib
@window.delegate = self
puts " at end of awake from nib. title is #{@window.title}"
end
def windowWillLoad
puts "window will be soon loaded"
end
def windowDidLoad
puts "window loaded"
end
def windowTitleForDocumentDisplayName(displayName)
"Hello World"
end
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo/macruby-devel
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo/macruby-devel
[MacRuby-devel] OpenGL framework: gl.h versus gl3.h
I am developing a basic MacRuby OpenGL library and I am avoiding the deprecated fixed-function pipeline in favor of OpenGL 3.2+ core functionality. The problem is Apple's OpenGL framework has two primary header files: gl.h and gl3.h. In Objective-C, I can just do: #import to access OpenGL 3.2 functions. In MacRuby, I seem to be limited to: framework 'OpenGL', which loads the older gl.h header. To a large extent it doesn't matter since much of the 3.2 core functions already existed in OpenGL 2.1. However, there are some functions I need that only exist in 3.2: glBindVertexArray glGenVertexArrays glDeleteVertexArrays Versions of those functions do exist in OpenGL 2.1 (gl.h) with the APPLE suffix (e.g. glBindVertexArrayAPPLE), but they do not work when using a 3.2 core context. I have worked around the issue with an Obj-C wrapper that imports gl3.h and wraps those specific functions, but it results in a warning: "gl.h and gl3.h are both included. Compiler will not invoke errors if using removed OpenGL functionality." At first glance, the clouds would part and the sun would shine if I could just load the gl3.h header from MacRuby instead of gl.h. However, I suspect that I would then be faced with a bridgesupport file that doesn't reflect gl3.h. Having a bit of Obj-C code in my library isn't the end of the world, but I'd like to avoid the multiple-header warning, plus possible problems that might result from using OpenGL 2.1 functions with a 3.2 context (although I haven't seen any yet). Any suggestions? Just port the whole kit to Obj-C and be done? Ugh. On a related note, these constants are supposed to be defined in AppKit.framework bridgesupport, but aren't: NSOpenGLPFAOpenGLProfile = 99 NSOpenGLProfileVersion3_2Core = 0x3200 Jim ___ MacRuby-devel mailing list [email protected] http://lists.macosforge.org/mailman/listinfo/macruby-devel
