[vtkusers] Re: including alpha channel in VTK image actor

Cam Crews camcrews at gmail.com
Mon Aug 22 12:51:35 EDT 2005


whoops, I do have a CVSed version of vtk, but looks like I was
misallocating my pixel index so the RGBA values became all confused. 
in the following code, does it look as if RGBA_buf correctly
configured to send to  the vtkFixedPointVolumeRayCastMapper?

/////////////////
int image_width = 256;
int image_height = 256;

unsigned char * RGBA_buf = new unsigned char[image_width * image_height * 4];

for( int y=0; y<image_height; y++ )
for( int x=0; x<image_width; x++ ) {
  int pixIdx = y * image_width + x;
  RGBA_buf[pixIdx * 4 + 0] = 255;  //red
  RGBA_buf[pixIdx * 4 + 1] = 0;    //green
  RGBA_buf[pixIdx * 4 + 2] = 0;    //blue
  RGBA_buf[pixIdx * 4 + 3] = 255;  //alpha - no transparency, opaque
}
///////////////

the vtkFixedPointVolumeRayCastMapper should not have a problem with
this, right?  thnx for your help!

Cam

On 8/22/05, David Gobbi <dgobbi at atamai.com> wrote:
> Hi Cam,
> 
> Are you using VTK 4.4?  This sounds like a row-alignment bug that can
> be seen in VTK 4.4.1 and VTK 4.4.2 but which was fixed in cvs:
> http://public.kitware.com/cgi-bin/viewcvs.cgi/*checkout*/Rendering/vtkOpenGLImageActor.cxx?rev=1.24.2.1
> 
> If you are using VTK 4.2 or VTK cvs, then this is probably a new bug.
> 
>  - David
> 
> 
> Cam Crews wrote:
> 
> >Sorry, accidently sent out a bit prematurely!
> >
> >I'm inputing a vtk image actor that's a vtk image data object -
> >when I try specifying with the 4 components (w/ alpha) it comes out
> >all distorted,
> >however, if I take out the alpha channel it displays normally.
> >
> >the VTK image actor calls glTexImage2D, so my problems may lie there..
> >
> >if any of you have experience w/ displaying the alpha channel
> >properly, I would appreciate your guidance.  Thanks!
> >
> >Cam
> >_______________________________________________
> >This is the private VTK discussion list.
> >Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> >Follow this link to subscribe/unsubscribe:
> >http://www.vtk.org/mailman/listinfo/vtkusers
> >
> >
> >
> 
>



More information about the vtkusers mailing list