[vtkusers] problem on write data array into window by vtkRenderWindow->SetPixelData()

Jin Bei hijinbei at hotmail.com
Thu Apr 7 19:06:48 EDT 2005


Hi, 
   Have you ever write a unsigned char array into the vtkRenderWindow 
directly before? I think it should be easy to use 
vtkRenderWindow->SetPixelData(), but it doesn't has any response!!! 
    
      int screenx, screeny; 
      unsigned int *resultdata; 
      screenx=*(renWin->GetSize()); 
      screeny=*(renWin->GetSize()+1); 
      resultdata=(unsigned int*)malloc(sizeof(unsigned 
int)*screenx*screeny*3); 
      for(i=0; i<screeny; i++) 
      { 
	for(j=0; j<screenx; j++) 
	{ 
          for(s=0; s<3; s++) 
	  { 
	     *(resultdata+i*screenx*3+j*3+s)=256; 
 	  } 
	} 
      } 
      renWin->SetPixelData(0, screenx-1, 0, screeny-1, resultdata, 0);  
      renWin->SetPixelData(0, screenx-1,0, screeny-1, resultdata, 1); 
      renWin->Modified(); 

      Before I met the problem of vtkfilereader, it must be Update( ) 
before get the data. But I use Modified() here, still have no response, but 
also has no error shown up. Anyone know why? Thank you!!!!

Bei Jin

_________________________________________________________________
使用全球用戶最多的電子郵件服務 MSN Hotmail: http://www.hotmail.com 




More information about the vtkusers mailing list