|
From: Lloyd D. <Ll...@5d...> - 2002-08-08 22:37:35
|
..mmhh.. I see.
Well it's simple.
I don't exactly understand why you are not able to create a new context,
maybe it fail because it doesn't want to have its pixelformat setted again,
when there is already a current GLContext, I should investigate.
Anyway, your problemis a context can't be current in multiple thread.
I saw you grab() the context but never drop() (or IsCurrent=false) it. so
when you try to make it current in another thread it is an error, it
complains, that normal.
But now, you have rthe solution, call drop at the end of OnPaint() or
whatever place you judge appropriate...
-----Original Message-----
From: csg...@li...
[mailto:csg...@li...]On Behalf Of Aron Ernvik
Sent: Wednesday, 7 August 2002 8:07
To: csg...@li...
Subject: [Csgl-users] problem using the same context in more than one
thread
CsGL users and developers,
I hope you can help me out with the following problem! I'm using CsGL for a
volume rendering application. I use an external volume rendering library
written in C++ for which I've written a managed wrapper. I've also created a
custom Control, VRTControl, which contains a ControlGLContext. In the
constructor I do
public VRTControl() {
...
ctxt = new ControlGLContext(this, CreateDisplayType());
ctxt.Grab();
// set up the context
GL.glShadeModel(GL.GL_SMOOTH);
GL.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
...and so on
}
Then there's a method called Render() in this VRTControl class:
public void Render() {
ctxt.Grab();
GL.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
if (scene != null) {
scene.Render(); // perform the actual volume rendering
glDraw(); // overlay graphics
GL.glFinish();
OpenGLException.Assert();
ctxt.SwapBuffer();
}
}
scene.Render() performs the actual volume rendering and its output is sent
to the OpenGL buffers. All this works perfectly when the same thread calls
the constructor and VRTControl.Render(). It's been a pleasure working with
CsGL so far! Now for the problem: the call to scene.Render() typically takes
a lot of time, so I want to call MyControl.Render() using a separate thread.
But when I try this, I get the error message "Can't make the context
current" from the ctxt.Grab() call. When I try to recreate the context using
the rendering thread I get the error message "Invalid device context (DC)
handle" when calling ctxt.Dispose() on the old one. Ignoring this message
doesn't help - nothing ever shows on the context that is created by the
rendering thread.
What is the right way to have more than one thread using the same OpenGL
context? Is it at all possible? Or is it at least possible to create a new
ControlGLContext in a Control using another thread than the one that created
the control? (I haven't managed so far!)
Thanks a lot for any help! And keep up the really good work with CsGL!
Best regards,
Aron Ernvik, Sweden
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Csgl-users mailing list
Csg...@li...
https://lists.sourceforge.net/lists/listinfo/csgl-users
|
|
From: Ben H. <be...@ex...> - 2002-08-27 23:33:10
|
Hi, I can't seem to use the CsGL.OpenGL.OpenGLControl in the WYSIWYG Designer of VisualStudio.NET. It complains of an "Exception from HRESULT: 0x80131019." I can not figure out where this exception is coming from. Does anyone else know how to fix this error? Cheeers, -ben http://www.exocortex.org/ben "Those who wish to succeed must ask the right preliminary questions." - Aristotle |
|
From: Lloyd D. <ll...@ga...> - 2002-08-28 09:48:56
|
I don't know but !... the latest release (not yest shipped but in beta here http://stuff.galador.net (at the bottom)) work well in VS.NET (provided you also copy the the csgl-native.dll in your directory, as it is not an assembly) (yes, I finally get rid of managed C++, and I have good reason for this) this is a nearly finish beta release, but I am writting an automatic extension generator, and when it will be finished I will ship this new CsGL with heaps of OpenGL extension. One very interesting class (not OpenGL related) is CsGL.Util.CFunction which permit you to call any C-Function pointer from C# without one line of C..... ----- Original Message ----- From: "Ben Houston" <be...@ex...> To: <csg...@li...> Sent: Wednesday, August 28, 2002 9:32 AM Subject: [Csgl-users] problem with using OpenGLControl in VS.NET > Hi, > > I can't seem to use the CsGL.OpenGL.OpenGLControl in the WYSIWYG > Designer of VisualStudio.NET. It complains of an "Exception from > HRESULT: 0x80131019." I can not figure out where this exception is > coming from. Does anyone else know how to fix this error? > > Cheeers, > -ben > http://www.exocortex.org/ben > "Those who wish to succeed must ask the right > preliminary questions." - Aristotle > > > ------------------------------------------------------- > This sf.net email is sponsored by: Jabber - The world's fastest growing > real-time communications platform! Don't just IM. Build it in! > http://www.jabber.com/osdn/xim > _______________________________________________ > Csgl-users mailing list > Csg...@li... > https://lists.sourceforge.net/lists/listinfo/csgl-users > |
|
From: Ben H. <be...@ex...> - 2002-08-30 15:07:18
|
Ben's recommendation would be to stick with a C++ .NET backend. I am not sure why you want to switch? -ben http://www.exocortex.org/ben "Those who wish to succeed must ask the right preliminary questions." - Aristotle > -----Original Message----- > From: Lloyd Dupont [mailto:ll...@ga...] > Sent: Wednesday, August 28, 2002 4:49 AM > To: Ben Houston; csg...@li... > Subject: Re: [Csgl-users] problem with using OpenGLControl in VS.NET > > I don't know but !... > the latest release (not yest shipped but in beta here > http://stuff.galador.net (at the bottom)) work well in VS.NET (provided > you > also copy the the csgl-native.dll in your directory, as it is not an > assembly) (yes, I finally get rid of managed C++, and I have good reason > for > this) > > this is a nearly finish beta release, but I am writting an automatic > extension generator, and when it will be finished I will ship this new > CsGL > with heaps of OpenGL extension. > > One very interesting class (not OpenGL related) is CsGL.Util.CFunction > which > permit you to call any C-Function pointer from C# without one line of > C..... > > ----- Original Message ----- > From: "Ben Houston" <be...@ex...> > To: <csg...@li...> > Sent: Wednesday, August 28, 2002 9:32 AM > Subject: [Csgl-users] problem with using OpenGLControl in VS.NET > > > > Hi, > > > > I can't seem to use the CsGL.OpenGL.OpenGLControl in the WYSIWYG > > Designer of VisualStudio.NET. It complains of an "Exception from > > HRESULT: 0x80131019." I can not figure out where this exception is > > coming from. Does anyone else know how to fix this error? > > > > Cheeers, > > -ben > > http://www.exocortex.org/ben > > "Those who wish to succeed must ask the right > > preliminary questions." - Aristotle > > > > > > ------------------------------------------------------- > > This sf.net email is sponsored by: Jabber - The world's fastest growing > > real-time communications platform! Don't just IM. Build it in! > > http://www.jabber.com/osdn/xim > > _______________________________________________ > > Csgl-users mailing list > > Csg...@li... > > https://lists.sourceforge.net/lists/listinfo/csgl-users > > |