[vtkusers] Using OpenGl with VTK

Utkarsh Ayachit utkarsh.ayachit at kitware.com
Thu Aug 14 08:20:05 EDT 2008


iren->Start() results in repeated calls to renWin->Render() on 
interaction. This will clear whatever you had drawn. A better approach 
is to subclass vtkProp(or one of it's subclasses) and put your rendering 
code in RenderOpaqueGeometry() / RenderTranslucentPolygonalGeometry()/ 
RenderOverlay() etc. depending upon what pass you want it to be rendered 
and then add the prop to the renderer. That way every time the renderer 
re-renders, your code will be executed.


Utkarsh

Mohammed Amine SAHTARI wrote:
> 
> I want to add an OpenGl code in an application of VTK.
> 
> For this purpose, I try to draw lines using commands OpenGL.:
> 
> *1) I add this on the top of the program :*
> 
> #include <GL/gl.h> 
> 
> *2) I place my OpenGL commands after renWin->Render() but before iren->Start()** :  *
> 
> 
> renWin->Render();
> 
>     glBegin (GL_LINES);
>        glVertex2f (-2.5, 2.5);
>        glVertex2f (2.5, -2.5);
>      glEnd ();
> 
> iren->Start();
> 
> 
> *But it doesn't appears.*
> 
> did I miss something ? How can I do this work ? 
> 
> Looking forward to hear from you soon,
> 
> Amine
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers



More information about the vtkusers mailing list