Hi there

For my bachelor thesis, I'm doing a reader in c++ to read in large amount of points and display them (from a solar system simulation output in a sqlite db), but i fail at setting transparency for certain points. Can anybody please point me to a tutorial or give me a hint? I did look around and saw i probably need a mapper or actor, with a lookuptable, (at least in vtk only it works like this) but i didn't find an example how to convert this to paraview. (witch would be great, because i'm totally new to pv and vtk).
How and where do i have to attach the mapper to?
I did get the coloring working, but no clue how to continue from here.

Many Thanks

Rafael Kueng
University of zurich

Here's a draft of my code:

int vtkSQLiteReader::RequestData(vtkInformation*,
        vtkInformationVector**,vtkInformationVector* outputVector)
{
        
        vtkPolyData * out = vtkPolyData::GetData(outputVector);

        if (!this->dataIsRead)
                // only read if it's not been read before
        {
                readSnapshots(); //reads in the coordinates and velocities of 
particles
                readTracks(); //reads in the tracks of the particles

                this->dataIsRead = true;
        }

        out->SetPoints(this->Position);
        out->SetVerts(this->Cells);
        out->SetLines(this->Tracks);
        out->GetPointData()->AddArray(this->Velocity);

        // update the colors in every update
        generateColors();
        out->GetPointData()->SetScalars(this->colors);
        
        return 1;
}


int vtkSQLiteReader::generateColors()
{
        this->colors = vtkSmartPointer<vtkUnsignedCharArray>::New();
        this->colors->SetName("Colors");
        this->colors->SetNumberOfComponents(3);
        this->colors->SetNumberOfTuples(this->nParticles);

        for (int i = 0; i<this->nParticles;i++)
        {
                // heres some code to choose the color per point..
                red = 255;
                green = 255;
                blue = 255;

                this->colors->InsertTuple3(i,
                                red,
                                green,
                                blue);
        }
        return 1;
}
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the ParaView Wiki at: 
http://paraview.org/Wiki/ParaView

Follow this link to subscribe/unsubscribe:
http://www.paraview.org/mailman/listinfo/paraview

Reply via email to