[Insight-users] renWin->InitializeFromCurrentContext() ;
yas ---
yas2349 at gmail.com
Mon Feb 25 07:14:41 EST 2013
#ifndef __APPLE_CC__#include <GL/glut.h>#else#include
<glut.h>#endif#include "vtkConeSource.h"#include
"vtkPolyDataMapper.h"#include "vtkRenderWindow.h"#include
"vtkCamera.h"#include "vtkActor.h"#include "vtkRenderer.h"#include
"vtkNew.h"
vtkNew<vtkRenderer> ren;
vtkNew<vtkRenderWindow> renWin;
void Reshape( int width, int height ){
renWin->SetSize( width, height );}
void Draw(){
renWin->Render();
ren->GetActiveCamera()->Azimuth( 1 );
glutPostRedisplay();}
I write follow code,but renwin hast not member InitializeFromCurrentContext()?
How to solve this problem,and how to use opengl in vtk?
int main( int argc, char **argv ){
// GLUT initialization
glutInit( &argc, argv );
glutInitDisplayMode( GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH );
glutCreateWindow( "VTK-GLUT Example") ;
glutReshapeFunc( Reshape );
glutDisplayFunc( Draw );
// Creation of a simple VTK pipeline
vtkNew<vtkConeSource> cone;
vtkNew<vtkPolyDataMapper> coneMapper;
coneMapper->SetInputConnection( cone->GetOutputPort() );
vtkNew<vtkActor> coneActor;
coneActor->SetMapper( coneMapper.GetPointer() );
ren->AddActor( coneActor.GetPointer() );
renWin->AddRenderer( ren.GetPointer() );
// Here is the trick: we ask the RenderWindow to join the current
OpenGL context created by GLUT
renWin->InitializeFromCurrentContext();
// Let's start the main GLUT rendering loop
glutMainLoop();
return EXIT_SUCCESS;}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20130225/21acbcea/attachment.htm>
More information about the Insight-users
mailing list