[R] rgl: exporting to pdf or png does not work

Gaspard Lequeux Gaspard.Lequeux.at at biomath.ugent.be
Thu Aug 24 17:19:10 CEST 2006


Hej,

On Wed, 23 Aug 2006, Duncan Murdoch wrote:

> On 8/23/2006 5:15 PM, Gaspard Lequeux wrote:
>
>> When exporting a image from rgl, the following error is encountered:
>>
>>> rgl.postscript('testing.pdf', fmt="pdf")
>> RGL: ERROR: can't bind glx context to window
>> RGL: ERROR: can't bind glx context to window
>> Warning messages:
>> 1: X11 protocol error: GLXBadContextState
>> 2: X11 protocol error: GLXBadContextState
>>
>> The pdf file is created and is readable, but all the labels are gone.
>>
>> Taking a snapshot (to png) gives 'failed' and no file is created.
>>
>> Version of rgl used: 0.67-2 (2006-07-11)
>> Version of R used: R 2.3.1; i486-pc-linux-gnu; 2006-07-13 01:31:16;
>> Running Debian GNU/Linux testing (Etch).
>
> That looks like an X11 error to me, not something that I'm very likely
> to be able to fix.  If you can debug the error, it would be helpful.

Actually after upgrading everything (debian testing (etch)) and restarting 
X, I didn't get that error anymore. It was worse: R crashed:

> library(rgl);triangles3d(c(1,,2,3),c(1,2,4),c(1,3,5));rgl.postscript('testing.pdf','pdf')
X Error of failed request:  GLXBadContextState
   Major opcode of failed request:  142 (GLX)
   Minor opcode of failed request:  5 (X_GLXMakeCurrent)
   Serial number of failed request:  85
   Current serial number in output stream:  85
glequeux at toidi:~/seqanal$


I downloaded the source package (debian testing (etch), rgl-0.67-2).

In rgl-0.67-2/src/ I changed the following files:

rglview.cpp, around line 587. Commenting the function call gl2psBeginPage 
removed the crash (but also no pdf output...)

I enabled this function again and went to gl2ps.c, to the function 
gl2psBeginPage. At the end of that function, around line 4426, commenting 
out the line
glRenderMode(GL_FEEDBACK);
removes the R crash, but of course still no pdf output (well, only the 
background).

GL_FEEDBACK is defined in /usr/include/GL/gl.h as:

/* Render Mode */
#define GL_FEEDBACK				0x1C01
#define GL_RENDER				0x1C00
#define GL_SELECT				0x1C02

Trying glRenderMode(GL_RENDER) removed the crash, but still only the 
background in the pdf.

If someone has some suggestions about what to do next...

/Gaspard



More information about the R-help mailing list