Can't really give much help without considerably more information (such
as *what* is showing up as shared between the contexts).
Interfere would have been a better wording than share actually. Basically my application is some kind of molecular viewer, displaying atoms (as rescaled gluSphere) with labels (as bitmaps). On the first OpenGL scene in the window I load a molecule into, everything displays nicely. But on the second one, the atoms don't show up and the labels have a different position than on the first scene. It looks as if some unwanted 3D transformation has been applied to the second scene.
It's
definitely possible to run multiple OpenGL contexts within a wxPython
application, at least in my limited testing. I've attached a script
which creates two independent OpenGLContext contexts within the same
frame. OpenGLContext is fairly anal about making sure everything occurs
within SetCurrent calls, but you say you're doing that already.
It's rather hard to compare my code to your example since I don't use OpenGLContext. But I have written a simple app displaying two such rotating cubes without OpenGLContext and it does indeed work. So it seems that the scene complexity matters here.
That said, I very seldom actually create multiple contexts, so they
don't get tested much by *me*, so there may be an error in how PyOpenGL
is handling the contexts (e.g. it may have an error in the array-pointer
management). (Would be helpful to know PyOpenGL version, platform, and
graphics card for tracking down such a problem, (a test-case showing the
problem tends to make debugging & fixing go much faster too)).
Sure! I was just testing the water temperature here. I have managed to make a self-contained program showing the problem. It displays two of my viewers side by side in the same window and build the same scene in both. It is displayed fine in the first heir of wx.GLCanvas to be instantiated but nothing appears in the last instantiated one. However it is 723 lines and I am therefore reluctant to flood this mailing list with it. Would you mind if I sent it directly to you?
BTW, probably best to ask these kinds of questions on the PyOpenGL list,
as OpenGL isn't really a *common* thing (AFAIK) in which wxPython people
specialise, (and most likely this is going to be an OpenGL (possibly
usage) error, rather than anything to do with wxPython).
Well, I should try using GLUT windowing instead of wxPython to see whether the latter is really the culprit.
Thank you very much for your help!
ยทยทยท
Luc Bourhis wrote:
> I've run into an insoluble problem with wxPython (2.5.x release). I
> have created a widget containing 2 instances of classes derived from
> wxGLCanvas: they seem to share at least part of the OpenGL context. I
> do call SetCurrent in a timely manner, first thing after catching the
> "paint" and the "resize" event, before any actual drawing or resizing.
> But it is still rather obvious there is interference between the both
> of these instances.
>
> Any pointer? I cannot find any reference to such an issue on the
> mailing lists.