[vtkusers] Draw a 2D cross on vtkImageActor

Jochen K. jochen.kling at email.de
Sun Jun 24 14:14:51 EDT 2012


Hi Jerry,


simply disable Lighting.

Add this before calling Draw2DGrid():


            _GL.Disable(OpenGL.GL_LIGHTING);


Btw. these lines should be added too:


            _GL.MatrixMode(MatrixMode.Modelview);
            _GL.LoadIdentity();


So in summary it looks like:


      void renderer_EndEvt(vtkObject sender, vtkObjectEventArgs e) {
         if(_IsOpenGLInitialized) {
            //Debug.WriteLine("renderer_EndEvt");

            // next commented line has the same effect as _GL.MakeCurrent()
            //renderWindowControl1.RenderWindow.MakeCurrent();
            _GL.MakeCurrent();
            _GL.MatrixMode(MatrixMode.Projection);
            _GL.LoadIdentity();
            _GL.Ortho(0, renderWindowControl1.Width,
renderWindowControl1.Height, 0, -10, 10);
            _GL.Clear(SharpGL.OpenGL.GL_DEPTH_BUFFER_BIT); // really needed
??? --> yes and no, try removing this call and change z coordinate of the
grid
            _GL.Disable(OpenGL.GL_LIGHTING);

            // draw our own stuff
            _GL.MatrixMode(MatrixMode.Modelview);
            _GL.LoadIdentity();
            Draw2DGrid();
            
            _GL.Flush();
            _GL.Blit(_Context);
         }
      }




with kind regards

Jochen

--
View this message in context: http://vtk.1045678.n5.nabble.com/Draw-a-2D-cross-on-vtkImageActor-tp5714166p5714185.html
Sent from the VTK - Users mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120624/68e2fc6b/attachment.htm>


More information about the vtkusers mailing list