[vtkusers] Help for Using OpenGL with VTK

sangmaxie sangmaxie at gmail.com
Wed Feb 8 20:37:19 EST 2012


Hi:
    I want to use OpenGL with VTK. For example, I want to draw a line with OpenGL like this:
                   glBegin (GL_LINES); 
                   glColor3f(1.0,0.0,0.0);
                   glVertex2f (-2.5, 2.5);
                   glVertex2f (2.5, -2.5);
                   glEnd ();
   And I want to render and display it with VTK classes, like vtkRenderer and vtkRenderWindow. But I don't know how to deal with it.
   The following codes can't work;
                   renWin->Render();
                   glBegin (GL_LINES);
                   glVertex2f (-2.5, 2.5);
                   glVertex2f (2.5, -2.5);
                   glEnd ();
                   iren->Start();
   Can you give me some examples and details? Thank you very much!
Sangma Xie




sangmaxie via foxmail
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120209/c78bd2f9/attachment.htm>


More information about the vtkusers mailing list