From: Ben H. <be...@ex...> - 2001-11-27 04:34:16
|
I added the following code inside "class OpenGLControl" to make sure that one disposes of the control with the same thread that one uses to create it: =20 class OpenGLControl { [...] protected Thread _threadParent =3D null; public OpenGLControl() { _threadParent =3D Thread.CurrentThread; [...] } protected override void Dispose( bool bDisposing ) { // Since OpenGL is thread dependent, OpenGLControl must // be disposed of by the same thread that created it. // The following assertion makes sure of the above: Debug.Assert( _threadParent =3D=3D Thread.CurrentThread ); [...] } [...] } -ben houston 4th Year Cognitive Science/Neuroscience Carleton University, Ottawa, Canada ( be...@ex... / 613-266-0637 ) =A0=20 > -----Original Message----- > From: csg...@li... [mailto:csgl-users- > ad...@li...] On Behalf Of Lloyd Dupont > Sent: Thursday, November 15, 2001 5:23 PM > To: Ben Houston > Cc: 'CsGL' > Subject: Re: [Csgl-users] another problem in "csopengl.c" >=20 > obviously the threading context dispose issue is tedious. >=20 > while i finish some code before doing a site update in a couple of hour. > (with the HG3D -> G3D issue and the new SDL_mixer class (for sound)) > the deleting context issue will wait a little. >=20 > anyway i have a solution for you. > try latest version of NeHe example. i rewrite lesson08 -> 17 > they no longer use a background thread calling Refresh() which is so > slow... >=20 > the new Main is the unthreaded following function: > static bool DemoRun =3D true; > public static void runDemo(DemoView aView, String title) > { > // init code... >=20 > window.Show(); > while(DemoRun) { > Application.DoEvents(); > view.OnPaint(null); > } > window.Hide(); > } > DemoRun is a global (static) variable set to false in 'ESC' key handler >=20 >=20 > _______________________________________________ > Csgl-users mailing list > Csg...@li... > https://lists.sourceforge.net/lists/listinfo/csgl-users |