[vtkusers] Embedded VTK in MFC App - Need additional openGL Window...

Kevin Siangchin kevinsiangchin at hotmail.com
Mon Oct 28 19:57:56 EST 2002



> Hello.
> Could use some tips. I have an MFC application with VTK embedded. I simply
> use vtk as a quick way to adjust camera position,etc. of a polygonal
> model(s). I would like to do additional rendering (raytracing/radiosity)
in
> an opengl window. First I'd like to ask for pointers as to how to do this
> effectively.
> Second, I've already created an opengl window class - generic WIN32
> implementation. The opengl window has its own event handler. My problems
are
> as follows:
>
> (1) For now the opengl window simply renders a colored triangle (w/o
> raytracing,etc). When the window is created and the scene is rendered I
seem
> to lose
> contact with the associated event handler. Specifically, in order for me
to
> respond again to mouse events and the like I have to click outside the
main
> application - either activate (bring to the foreground) another
application
> or click on the taskbar slot [for lack of a better term] of the opengl
> window or main application window - then reactivate the opengl window. In
> other words, I have to deactivate (send to background) the main
application
> or the opengl window, then reactivate (send to the foreground), in order
for
> the opengl window to respond to messages. After this transition from
> foreground (after creation) to background to foreground, the messages seem
> like they are routed to the right handlers. NOTE: This problem occurs even
> when I create the opengl window in a simple AppWizard Generated SDI
> application. (see http://xtopia0.tripod.com/testcode/openglwintest.zip for
> the code )
>
>
> (2) When I return to the main application I no longer can render anything
> using my VTK window. That window simply repaints - upon resize, move,
etc -
> the scene prior to the spawning the opengl window. I can no longer use the
> vtkInteractor to change that scene (or perhaps I can use the interactor,
but
> the rendering does not occur) or display other objects. I just get the
scene
> prior to the creation and displaying of the opengl window. I suspect it
may
> have to do with VTK's rendering context.
>
> Any suggestions on how to create/manage an separate opengl window in an
MFC
> application using VTK would be greatly appreciated. And any help with (1)
> and (2) would likewise be appreciated.
>
> Thanks.
> ks
>



More information about the vtkusers mailing list