[GRASS5] PNG driver problem

Hamish hamish_nospam at yahoo.com
Wed Aug 25 01:22:28 EDT 2004


[NVIZ max res. PPM image dump causing crash]

> > Then, next time I change a knob and redraw the NVIZ display, it
> > breaks:
> > 
> > X Error of failed request:  GLXBadContextTag
> >   Major opcode of failed request:  144 (GLX)
> >   Minor opcode of failed request:  1 (X_GLXRender)
> 
> I get exactly the same thing, but right away.
> 
> I'm pretty sure I know what's causing it.
> 
> Create_OS_Ctx() stores the current drawable an GLX context, and
> Destroy_OS_Ctx() restores them. The problem is that the code in
> do_zoom.c opens another connection to the X display itself. From the
> perspective of the X server, do_zoom.c is a separate client to the
> rest of NVIZ. And from the perspective of Xlib, the Display used by
> do_zoom.c is a different display to the one which is used by the rest
> of NVIZ.
> 
> IOW, do_zoom.c shouldn't be trying to do anything with NVIZ' X
> resources, because they belong to a different client and a different
> display.
> 
> If do_zoom.c wants to create its own X connection (even to a different
> X server), its own GLX context, and its own X/GLX resources, that's
> fine, and it should all work.
> 
> If I change the glXMakeCurrent() call which attempts to restore the
> old context to simply release the existing context, then it doesn't
> crash. However, subsequently moving the viewpoint etc doesn't result
> in the display being redrawn (because there isn't a current context). 
> But if you resize the view window, everything then works again
> (presumably, Togl explicitly restores the context as part of the
> resize handling).
> 
> AFAICT, the correct solution is to force Togl to restore the context
> before each redraw, and for do_zoom.c to not to access X resources
> (window, GLX context) which belong to a different client and a
> different display.
> 
> Try the attached patch.


seems to work fine, no need to resize the NVIZ view window.


The resulting image is still very dark.



Hamish




More information about the grass-dev mailing list