[Xquartz-dev] Help requested debugging rgl under XQuartz
Duncan Murdoch
murdoch.duncan at gmail.com
Mon Feb 22 14:38:15 PST 2021
I've made a little bit of progress.
The message "error: xp_attach_gl_context returned: 2" comes from the
Mesa routine surface_make_current, which calls xp_attach_gl_context. I
haven't found where xp_attach_gl_context is defined.
Secondly, the quartz() call in my example below starts several threads
in R. Execution of open3d() happens in the same thread with or without
the quartz() call, but the other threads in the process are quite
different. I don't know how this would affect things, but maybe I need
to re-initialize everything related to XQuartz.
Duncan Murdoch
On 22/02/2021 10:13 a.m., Duncan Murdoch wrote:
> I hope this is the right list for this request.
>
> I'm the developer of the rgl package for R, which uses glX to produce
> displays in macOS and Linux.
>
> It contains some kind of bug, which can be triggered (in both XQuartz
> 2.7.11 and 2.8.0beta4) by the following script run in R in a terminal:
>
> library(rgl) # Load the package; it opens and closes a glX window
> # during initialization
> quartz() # Open a regular R graphics window that works directly
> # with Quartz
> open3d() # Attempt to open a glX window
>
> This produces the following errors:
>
> error: xp_attach_gl_context returned: 2
> Error in rgl.open(useNULL) : 'rgl.open' failed
> In addition: Warning message:
> In rgl.open(useNULL) : RGL: ERROR: can't bind glx context to window
>
> The first line appears to be coming from XQuartz when the C++ code
> attempts to execute
>
> glXMakeCurrent(factory->xdisplay, xwindow, glxctx)
>
> in the X11WindowImpl::beginGL function. The other lines are coming from
> rgl or R.
>
> I'm reasonably sure this is a bug in my code, because I can successfully
> run glxgears from R, and open x11() windows in R, but after lots of time
> debugging I can't figure out where the problem is.
>
> Can anyone here suggest the kinds of issues that would lead to the
> "error: xp_attach_gl_context returned: 2" message, and ways to track
> down the underlying problem?
>
> If anyone wants to try the code, it's probably best to use the update of
> rgl that's at
>
> www.murdoch-sutherland.com/temp/rgl_0.105.14.2.tar.gz
>
> which fixes some bugs in the CRAN version.
>
> Duncan Murdoch
>
More information about the Xquartz-dev
mailing list