[vtkusers] My own OpenGL calls in vtk based applications? How to?

Ted Christiansen ted at caept.com
Tue Sep 3 13:08:16 EDT 2002


Hello,

Is it possible to use OpenGL calls in a vtk application?  What must be
done before the calls to set contexts, etc?  The simple code below did
not work.

Ted

 // for drawing rubber band box during zoom window operation...
 CDC *pDC = GetDC();

 GetClientRect(&viewrect);
 float pt1[] = { point.x, viewrect.top, 0 };
 float pt2[] = { point.x, viewrect.bottom, 0 };

 Renderer->SetDisplayPoint(pt1[0], pt1[1], pt1[2]);
  Renderer->DisplayToWorld();
  Renderer->GetWorldPoint(pt1);

  Renderer->SetDisplayPoint(pt2[0], pt2[1], pt2[2]);
  Renderer->DisplayToWorld();
  Renderer->GetWorldPoint(pt2);
  // pt1[2] = pt[2] = 0;

  glColor3f(1.0,1.0,1.0);
  glBegin(GL_LINES);
  glVertex3f(pt1[0], pt1[1], 0);
  glVertex3f(pt2[0], pt2[1], 0);
  glEnd();







More information about the vtkusers mailing list