[vtkusers] Rending texture problem
quengzi
quengzi at gmail.com
Sat Sep 25 11:22:51 EDT 2010
Hi all,
I'm a newer of VTK, I use VTK Dotnet to open a 3ds file, someone tell me
that vtk3DSImpoter do not support texture, so I want to draw it by manual,
but it failed, I cannot see any different after add the texture by manual,
below is my code:
string fileName = @"E:\VTK\3D Module\Mickey\Mickey.3ds";
vtk3DSImporter importer = new vtk3DSImporter();
importer.ComputeNormalsOn();
importer.SetFileName(fileName);
importer.Read();
importer.GetRenderer().ResetCamera();
importer.DebugOn();
//Add or Remove this section, no differents
vtkPNGReader pngReader = new vtkPNGReader();
pngReader.SetDebug(1);
pngReader.SetFileName(@"E:\VTK\3D Module\Mickey\l.png");
vtkTexture texture = new vtkTexture();
texture.SetInput(pngReader.GetOutput());
texture.InterpolateOn();
vtkActor actor = new vtkActor();
actor.SetTexture(texture);
importer.GetRenderer().AddActor(actor);
//Below is add a light, and it's okay
vtkLight light = new vtkLight();
light.SetColor(1,1 , 1);
light.SwitchOn();
light.SetIntensity(0.9);
light.SetAmbientColor(1, 1, 1);
light.SetPosition(importer.GetRenderer().GetActiveCamera().GetPosition());
light.SetFocalPoint(importer.GetRenderer().GetActiveCamera().GetFocalPoint());
importer.GetRenderer().SetBackground(0.1,0.2,0.4);
importer.GetRenderer().AddLight(light);
renderer[0] = importer.GetRenderer();
AddRendererToRenderWindow(renWin);
...
Any suggestions will be appropriated.
Thanks,
Yun
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100925/71dca4d5/attachment.htm>
More information about the vtkusers
mailing list