[vtkusers] Help for Using OpenGL with VTK
David Doria
daviddoria at gmail.com
Wed Feb 8 20:53:35 EST 2012
2012/2/8 sangmaxie <sangmaxie at gmail.com>:
> 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
If you're using VTK, why use OpenGL calls directly instead of
something like this:
http://www.vtk.org/Wiki/VTK/Examples/Cxx/GeometricObjects/Line
?
David
More information about the vtkusers
mailing list