[PATCH] proposal for the OpenGL system on Win32 ( msw/glcavans.cpp )

Giuseppe Bilotta bilotta78 at hotpop.com
Sat Sep 30 16:57:22 PDT 2006


On Sat, 30 Sep 2006 10:36:24 +0200, Carsten Fuchs wrote:

> Hi Guiseppe,

(Pssst, don't let anyone know, but it's spelt with the i before the u,
and it's pronounced as if it was joosehppeh. And don't worry, I still
have to find a foreigner that spells it correctly ;))

> I'm none of the wx-devs, but I worked a bit with the wxGL* code, too,
> and so I took the freedom to have a quick look at your proposal. (I'm a
> bit in a hurry this morning, but will have another look on Monday or
> Tuesday.)

> It would certainly be nice if the programmer you mentioned would join in
> here - I too tend to have problems to survey all ramifications that
> changes in wx code may have, and so hearing the opinion from the patch
> author is always a help.

Thank you very much for your reply. I'm sort of acting as a 'bridge'
between this thread and the relevant discussion on the s3dconnector,
and I suggested the developer he could use the gmane interface to the
mailing list if he doesn't feel like subscribing.

Anyway, in the mean time I let him know about your suggestins, and he
confirms that your suggestion

> 2) Therefore, instead I think that there should be some reference
> counting mechanism that registers the window class before the first
> wxGLCanvas is opened, and releases it after the last wxGLCanvas has been
> closed. This reference counting mechanism had to work across exe/dll
> boundary in order to solve the problem that you described.
> This would probably the "best" or "most elegant" solution, but not the
> most simple.

is the best one. Precisely:

"""
The reference counting way is definitely the way to go, and I don't
think it would be that difficult if the increment and decrement were
put in the wxGLCanvas constructor and destructor. My hack only works
for me because there's no GL canvas in the main application.
"""

My personal doubts (at 2am, from the POV of someone which is all but
proficient in C++) were more geared towards the thread-safety of this
mechanism (how thread-safe are class variables in C++?) and
optimization possibilities (is a mutex needed to update the counter
and check it against 0 to see if we should unregister the window
class? in this case, would it be better to check against 0 on a
separate mutex call than the decrementer in the destructor?)



-- 
Giuseppe "Oblomov" Bilotta

[W]hat country can preserve its liberties, if its rulers are not
warned from time to time that [the] people preserve the spirit of
resistance? Let them take arms...The tree of liberty must be
refreshed from time to time, with the blood of patriots and
tyrants.
	-- Thomas Jefferson, letter to Col. William S. Smith, 1787





More information about the wx-dev mailing list