[vtkusers] [Insight-users] renWin->InitializeFromCurrentContext() ;

Dženan Zukić dzenanz at gmail.com
Mon Feb 25 13:17:18 EST 2013


You sent this to the wrong list. You should have sent it to VTK users, not
Insight users.


On Mon, Feb 25, 2013 at 7:14 AM, yas --- <yas2349 at gmail.com> wrote:

> #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;}
>
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.php
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130225/ab97dbe4/attachment.htm>


More information about the vtkusers mailing list