[vtkusers] Help for Using OpenGL with VTK

Rocco Gasteiger post at rocco-gasteiger.de
Thu Feb 9 03:34:13 EST 2012


Hey Sangma,

you can derive your own Mapper from vtkPolyDataMapper, overwrite the
Render(...) function and place you own OpenGL-code in that function. Then
you use your mapper in combination with an actor and the renderer.

Best regards, Rocco

--------------------------------------------------

Dipl.-Ing. Rocco Gasteiger

 

Otto-von-Guericke University

Faculty of Computer Science

Department of Simulation and Graphics

Universitätsplatz 2, 39106 Magdeburg, Germany

 

Office:  G29-223

Phone:   +49 391 67 127 59

Fax:     +49 391 67 111 64

Website:  <http://www.vismd.de/> http://www.vismd.de

-------------------------------------------------

 

 

 

Von: vtkusers-bounces at vtk.org [mailto:vtkusers-bounces at vtk.org] Im Auftrag
von sangmaxie
Gesendet: Donnerstag, 9. Februar 2012 02:37
An: vtkusers
Betreff: [vtkusers] Help for Using OpenGL with VTK

 

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/b78a9288/attachment.htm>


More information about the vtkusers mailing list