Skip to content

R 2.3.0 and rgl on OS X 10.4.6

2 messages · Hans-Jörg Bibiko, Simon Urbanek

#
Dear all,


I found this thread about R 2.3.0 and rgl on OS X 10.4.6 in the  
internet.


I had the same problem. I fixed the source code for api.cpp in that way:

I only changed both lines with -> void rgl_win... ( ... , int* view)  
into void rgl_win... ( ... , GLint* view)

line ca. 597 rgl version 0.66
...
void rgl_user2window(int* successptr, int* idata, double* point,  
double* pixel, double* model, double* proj, GLint* view)
{
   int success = RGL_FAIL;
   GLdouble* vertex = pixel;
   int columns = idata[0];

   Device* device = deviceManager->getAnyDevice();

   if ( device ) {
   	for (int i=0; i<columns; i++) {
		gluProject(point[0],point[1],point[2],model,proj,view,
		vertex,vertex+1,vertex+2);
		vertex[0] /= view[2];
		vertex[1] /= view[3];
		point += 3;
		vertex += 3;
	}
	success = RGL_SUCCESS;
   }

   *successptr = success;
}

void rgl_window2user(int* successptr, int* idata, double* point,  
double* pixel, double* model, double* proj, GLint* view)
{
   int success = RGL_FAIL;
   GLdouble* vertex = point;
   int columns = idata[0];

   Device* device = deviceManager->getAnyDevice();

   if ( device ) {
   	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,
		vertex,vertex+1,vertex+2);
		pixel += 3;
		vertex += 3;
	}
	success = RGL_SUCCESS;
   }

   *successptr = success;
}

...


Then I recompiled this and everything works fine.


It is the first time I post something here and I don't know whether  
it is the right place but ...


All the best

Hans-Joerg Bibiko
#
Hans-Joerg,
On May 23, 2006, at 12:12 PM, Hans-Joerg Bibiko wrote:

            
So why didn't you use the fix?
That is a very bad hack and I don't recommend using it. The only  
reason it works is that in 32-bit mode gcc int and long have the same  
size. It will break horribly if compiled as 64-bit. I don't know if  
you actually looked at the reason, but GLint is defined as long - so  
in is NOT int! That is why the compiler is (correctly) complaining.

Cheers,
Simon