[vtkusers] Its works the first time but not the third !!!

Paul Tait paul at opes.com.au
Wed Apr 7 03:05:56 EDT 2004


We have an MFC app that uses a third party 2D graphics library and to make sure both use the same colors we use the following bit of code. The first time its gets excuted everything runs find but the third we get an access violation on line

void InitTraversal() { this->Current = this->Top;};

in vtkCollection.h



// create a top lookup table
 float rgb[4]; 
 vtkLookupTable *topLut = 0;                
 topLut = vtkLookupTable::New();      <------- crash here
 topLut->SetNumberOfColors(96);
 topLut->SetHueRange(0.7, 0);
 topLut->SetSaturationRange(1, 1);
 topLut->SetValueRange(0.8, 1);
 topLut->Build();
 topLut->ForceBuild();
 
 int i, j = 0;
 for( i = 32; i < 128; i++ )
 {
      topLut->GetTableValue(j, rgb);
      GSSetPal(i, rgb[0] * 255.0, rgb[1] * 255.0, rgb[2] * 255.0);
      j++;
 }
    
 topLut->Delete();

Any ideas ?  

At this point no other vtk code has been excuted. Is it some weird intialisation problem ?

Paul Tait




---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.651 / Virus Database: 417 - Release Date: 4/5/2004
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20040407/5a4f0428/attachment.htm>


More information about the vtkusers mailing list