From murdoch at stats.uwo.ca  Sat May  6 13:03:47 2006
From: murdoch at stats.uwo.ca (Duncan Murdoch)
Date: Sat, 06 May 2006 07:03:47 -0400
Subject: [Rd] R 2.3.0 and rgl on OS X 10.4.6
In-Reply-To: <C5B8BD22-D6BD-444B-A338-1A5498C7080A@r-project.org>
References: <20060504180847.EBEC119B99@slim.kubism.ku.dk>
	<C5B8BD22-D6BD-444B-A338-1A5498C7080A@r-project.org>
Message-ID: <445C8293.5080903@stats.uwo.ca>

On 5/5/2006 9:50 PM, Simon Urbanek wrote:
> Neely,
> 
> as Duncan was saying R-SIG-Mac is a better place to discuss it.
> 
> On May 4, 2006, at 2:08 PM, eatkinso at mdanderson.org wrote:
> 
>> I just downloaded and installed R 2.3.0 on my Mac G5 running OS X  
>> 10.4.6. I also updated with R.app revision 3114 as ecommended. Now,  
>> when I attemp to use package rgl
>> I get the error
>>
>>> library(rgl)
>> Error: package 'rgl' is not installed for 'arch=ppc'
> 
> This usually means that you have an old package for R 2.2.0 and you  
> are trying to use it in R 2.3.0. *)

Oops, sorry about my "more commonly used platform" comment.  I thought 
this was an older Mac platform, not a current one.

> 
>> I have tried reinstalling from CRAN using both binary and source.  
>> The source install fails, The binary install yields
>>
> 
> AFAIR rgl is currently broken, so there is no binary:
> http://r.research.att.com/reports/tiger-universal/results/2.3.0/html/ 
> rgl.report.html
> I remember fixing this a while ago - it wasn't as simple as casting,  
> because the structures are wrong, but I'll see if I can dig out the fix.

A simple fix for the error shown on that page is in the patch below. 
(The line numbers don't match because I'm working with an unreleased 
version.)  I'm hoping there will be another release soon; there are some 
additions to rgl.

Duncan Murdoch

Index: api.cpp
===================================================================
--- api.cpp	(revision 453)
+++ api.cpp	(working copy)
@@ -680,12 +680,14 @@
    int success = RGL_FAIL;
    GLdouble* vertex = pixel;
    int columns = idata[0];
+  GLint viewport[4];

    Device* device = deviceManager->getAnyDevice();

    if ( device ) {
+  	for (int i=0; i<4; i++) viewport[i] = view[i];
    	for (int i=0; i<columns; i++) {
-		gluProject(point[0],point[1],point[2],model,proj,view,
+		gluProject(point[0],point[1],point[2],model,proj,viewport,
  		vertex,vertex+1,vertex+2);
  		vertex[0] /= view[2];
  		vertex[1] /= view[3];
@@ -703,14 +705,16 @@
    int success = RGL_FAIL;
    GLdouble* vertex = point;
    int columns = idata[0];
+  GLint viewport[4];

    Device* device = deviceManager->getAnyDevice();

    if ( device ) {
+    	for (int i=0; i<4; i++) viewport[i] = view[i];
    	for (int i=0; i<columns; i++) {
  	        pixel[0] *= view[2];
  	        pixel[1] *= view[3];
-		gluUnProject(pixel[0],pixel[1],pixel[2],model,proj,view,
+		gluUnProject(pixel[0],pixel[1],pixel[2],model,proj,viewport,
  		vertex,vertex+1,vertex+2);
  		pixel += 3;
  		vertex += 3;



[Rd] R 2.3.0 and rgl on OS X 10.4.6
Duncan Murdoch