[R-SIG-Mac] rgl for R-devel

Simon Urbanek simon.urbanek at r-project.org
Sat Jul 19 17:31:24 CEST 2014


On Jul 19, 2014, at 6:05 AM, Duncan Murdoch <murdoch.duncan at gmail.com> wrote:

> On 19/07/2014, 4:42 AM, Duncan Murdoch wrote:
>> On 18/07/2014, 8:18 PM, Simon Urbanek wrote:
>>> Duncan,
>>> 
>>> I didn't look at the code, but the approach seems strange - if you use something from the GLKit framework then the include should be
>>> 
>>> #include <GLKit/GLKMathUtils.h>
>>> 
>>> without specifying -I... You should never have the need to include the "Headers" directory directly (other than cases where the framework contains non-framework headers like R does) since frameworks are searched automatically when referenced.
>> 
>> Thanks.  I forget where that code came from.  Obviously I don't know
>> much about OSX programming.
>> 
>> One other question that might be simple, or might not:  I'm seeing
>> problems in Cocoa because after a user closes an rgl window (by clicking
>> on the x on the frame), the cleanup code is not being called.  rgl declares
>> 
>> @interface GLView : NSOpenGLView {
>>  rgl::OSXWindowImpl *impl;
>>  NSUInteger lastModifierFlags;
>> }
>> 
>> - (id)initWithFrame:(NSRect)frame
>>        pixelFormat:(NSOpenGLPixelFormat *)pixelFormat
>>               impl:(rgl::OSXWindowImpl *)impl;
>> @end
>> 
>> and then in the implementation section has the cleanup code in
>> 
>> - (void)dealloc
>> {
>>  if (impl) impl->on_dealloc();
>>  [super dealloc];
>> }
>> 
>> but as far as I can tell this isn't being called when the user closes
>> the window.  Is there some other method that is called to allow cleanup?
>> The Apple docs probably talk about this somewhere, but I haven't found
>> where...
>> 
> 
> More precisely:  this isn't being called *immediately* when the window
> is closed.  It is called a little bit later, but in some circumstances
> that's too late, because the user can ask rgl to do something in between
> and it tries to make changes to a window that isn't there any more.
> 

Yes, dealloc is asynchronous, because it gets called only when the object is actually released which is only after garbage collection (or allocation pool flush). For immediate action I would recommend windowShouldClose: (can cancel) or windowWillClose: (cannot cancel) window delegate methods.

Cheers,
Simon


> Duncan Murdoch
> 
>> Duncan Murdoch
>> 
>>> 
>>> @Roger: on 10.9.2 (darwin 13.1.0 - which matches your build) I see
>>> $ ls -l /System/Library/Frameworks/GLKit.framework/Headers/
>>> total 16
>>> -rw-r--r--  1 root  wheel   7327 Apr 11 05:49 GLKBaseEffect.h
>>> -rw-r--r--  1 root  wheel   1435 Apr 11 05:49 GLKEffectProperty.h
>>> [...]
>>> -rw-r--r--  1 root  wheel   1224 Apr 11 05:49 GLKMathUtils.h
>>> [...]
>>> 
>>> Cheers,
>>> Simon
>>> 
>>> 
>>> On Jul 18, 2014, at 9:07 PM, Duncan Murdoch <murdoch.duncan at gmail.com> wrote:
>>> 
>>>> On 18/07/2014, 4:41 PM, Roger Koenker wrote:
>>>>> I'm trying to
>>>>> 
>>>>> install.packages("rgl", type = "source")
>>>>> 
>>>>> with
>>>>> 
>>>>>> sessionInfo()
>>>>> R Under development (unstable) (2014-07-09 r66111)
>>>>> Platform: x86_64-apple-darwin13.1.0 (64-bit)
>>>>> 
>>>>> locale:
>>>>> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
>>>>> 
>>>>> attached base packages:
>>>>> [1] stats     graphics  grDevices utils     datasets  methods   base     
>>>>> 
>>>>> other attached packages:
>>>>> [1] quantreg_5.05 SparseM_1.05 
>>>>> 
>>>>> loaded via a namespace (and not attached):
>>>>> [1] tcltk_3.2.0 tools_3.2.0
>>>>> 
>>>>> and seeing (eventually):
>>>>> 
>>>>> clang++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/System/Library/Frameworks/GLKit.framework/Headers -I/System/Library/Frameworks/OpenGL.framework/Headers  -DHAVE_PNG_H -I/usr/local/include/libpng12 -I/usr/X11/include -DDarwin -DNO_GL_PREFIX -I/usr/X11R6/include -DHAVE_FREETYPE -Iext/ftgl -I/opt/X11/include/freetype2 -Iext -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include   -Wall -mtune=core2 -g -O2  -fPIC  -Wall -mtune=core2 -g -O2  -c platform.cpp -o platform.o
>>>>> platform.cpp:16:10: fatal error: 'GLKMathUtils.h' file not found
>>>>> #include <GLKMathUtils.h> 
>>>>>        ^
>>>>> 1 error generated.
>>>>> make: *** [platform.o] Error 1
>>>>> ERROR: compilation failed for package ‘rgl’
>>>>> 
>>>>> I do have a GLKit.framework  but there is no Headers subdir ...  
>>>>> 
>>>> 
>>>> What OSX version is that?  There were warnings about deprecated code in
>>>> rgl, so I switched to using GLKMathUtils, but apparently the configure
>>>> script isn't quite right.
>>>> 
>>>> Duncan Murdoch
>>>> 
>>>> _______________________________________________
>>>> R-SIG-Mac mailing list
>>>> R-SIG-Mac at r-project.org
>>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>>>> 
>>> 
>> 
> 



More information about the R-SIG-Mac mailing list