<div dir="ltr">Here is a rough example (maybe not 100% but close, I just grabbed the key parts form TestCubeMap2.cxx. It uses 6 square textures and assembles them into a cube map.<div><br></div><div><div> const char* fpath[] =</div><div> {</div><div> "Data/skybox/posx.jpg",</div><div> "Data/skybox/negx.jpg",</div><div> "Data/skybox/posy.jpg",</div><div> "Data/skybox/negy.jpg",</div><div> "Data/skybox/posz.jpg",</div><div> "Data/skybox/negz.jpg"</div><div> };</div><div><br></div><div> vtkNew<vtkTexture> texture;</div><div> texture->CubeMapOn();</div><div> texture->InterpolateOn();</div><div> texture->RepeatOff();</div><div> texture->EdgeClampOn();</div><div><br></div><div> // mipmapping works on many systems but is not</div><div> // core 3.2 for cube maps. VTK will silently</div><div> // ignore it if it is not supported.</div><div> texture->MipmapOn();</div><div><br></div><div> for (int i = 0; i < 6; i++)</div><div> {</div><div> vtkNew<vtkJPEGReader> imgReader;</div><div> imgReader->SetFileName(</div><div> vtkTestUtilities::ExpandDataFileName(argc, argv, fpath[i]));</div><div> vtkNew<vtkImageFlip> flip;</div><div> flip->SetInputConnection(imgReader->GetOutputPort());</div><div> flip->SetFilteredAxis(1); // flip y axis</div><div> texture->SetInputConnection(i, flip->GetOutputPort(0));</div><div> }</div><div><br></div><div> vtkNew<vtkSkybox> world;<br></div><div> world->SetTexture(texture);</div><div> renderer->AddActor(world);</div></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Jan 27, 2018 at 3:11 PM, BBerco <span dir="ltr"><<a href="mailto:bebe0705@colorado.edu" target="_blank">bebe0705@colorado.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I am trying to display a skybox environment using the vtkOpenGLSkybox class.<br>
<br>
The documentation of vtkSkybox says that a texture cube must be provided. I<br>
used this one<br>
<<a href="https://www.google.com/search?q=cubic+texture+file&source=lnms&tbm=isch&sa=X&ved=0ahUKEwjiw7q09PjYAhVSyGMKHYKVAq8Q_AUICigB&biw=1280&bih=703#imgrc=-t5W2ikSKVWtQM" rel="noreferrer" target="_blank">https://www.google.com/<wbr>search?q=cubic+texture+file&<wbr>source=lnms&tbm=isch&sa=X&ved=<wbr>0ahUKEwjiw7q09PjYAhVSyGMKHYKVA<wbr>q8Q_AUICigB&biw=1280&bih=703#<wbr>imgrc=-t5W2ikSKVWtQM</a>:><br>
<br>
I'm providing the skybox actor with a cube source. But s you can see below,<br>
the texture is not properly mapped.<br>
<br>
Any advice?<br>
<br>
<<a href="http://vtk.1045678.n5.nabble.com/file/t341520/Screen_Shot_2018-01-27_at_13.png" rel="noreferrer" target="_blank">http://vtk.1045678.n5.nabble.<wbr>com/file/t341520/Screen_Shot_<wbr>2018-01-27_at_13.png</a>><br>
<br>
<br>
main.cpp:<br>
*<br>
#include <vtkSphereSource.h><br>
#include <vtkCubeSource.h><br>
#include <vtkPolyData.h><br>
#include <vtkSmartPointer.h><br>
#include <vtkPolyDataMapper.h><br>
#include <vtkActor.h><br>
#include <vtkRenderWindow.h><br>
#include <vtkRenderer.h><br>
#include <vtkRenderWindowInteractor.h><br>
#include <vtkOpenGLSkybox.h><br>
#include <vtkImageReader2Factory.h><br>
#include <vtkTexture.h><br>
#include <vtkTransformTextureCoords.h><br>
#include <vtkImageReader2.h><br>
<br>
int main(int, char *[])<br>
{<br>
<br>
<br>
<br>
// Read texture file<br>
vtkSmartPointer<<wbr>vtkImageReader2Factory> readerFactory =<br>
vtkSmartPointer<<wbr>vtkImageReader2Factory>::New()<wbr>;<br>
vtkImageReader2 *imageReader = readerFactory<br>
->CreateImageReader2("../map.<wbr>png");<br>
<br>
imageReader->SetFileName("../<wbr>map.png");<br>
<br>
// Create texture<br>
vtkSmartPointer<vtkTexture> texture =vtkSmartPointer<vtkTexture>::<wbr>New();<br>
texture->SetInputConnection(<wbr>imageReader->GetOutputPort());<br>
<br>
<br>
// Create a cube<br>
vtkSmartPointer<vtkCubeSource> skybox_source =<br>
vtkSmartPointer<vtkCubeSource><wbr>::New();<br>
<br>
<br>
vtkSmartPointer<<wbr>vtkPolyDataMapper> skybox_mapper =<br>
vtkSmartPointer<<wbr>vtkPolyDataMapper>::New();<br>
skybox_mapper-><wbr>SetInputConnection(skybox_<wbr>source->GetOutputPort());<br>
<br>
// Create the skybox<br>
vtkSmartPointer<<wbr>vtkOpenGLSkybox> skybox =<br>
vtkSmartPointer<<wbr>vtkOpenGLSkybox>::New();<br>
<br>
skybox -> SetTexture(texture);<br>
skybox -> SetMapper(skybox_mapper);<br>
<br>
<br>
<br>
<br>
<br>
// Create a sphere<br>
vtkSmartPointer<<wbr>vtkSphereSource> sphereSource =<br>
vtkSmartPointer<<wbr>vtkSphereSource>::New();<br>
sphereSource->SetCenter(0.0, 0.0, 0.0);<br>
sphereSource->SetRadius(5.0);<br>
<br>
vtkSmartPointer<<wbr>vtkPolyDataMapper> mapper =<br>
vtkSmartPointer<<wbr>vtkPolyDataMapper>::New();<br>
mapper->SetInputConnection(<wbr>sphereSource->GetOutputPort())<wbr>;<br>
<br>
vtkSmartPointer<vtkActor> actor =<br>
vtkSmartPointer<vtkActor>::<wbr>New();<br>
actor->SetMapper(mapper);<br>
<br>
vtkSmartPointer<vtkRenderer> renderer =<br>
vtkSmartPointer<vtkRenderer>::<wbr>New();<br>
vtkSmartPointer<<wbr>vtkRenderWindow> renderWindow =<br>
vtkSmartPointer<<wbr>vtkRenderWindow>::New();<br>
renderWindow->AddRenderer(<wbr>renderer);<br>
vtkSmartPointer<<wbr>vtkRenderWindowInteractor> renderWindowInteractor =<br>
vtkSmartPointer<<wbr>vtkRenderWindowInteractor>::<wbr>New();<br>
renderWindowInteractor-><wbr>SetRenderWindow(renderWindow);<br>
<br>
// renderer->AddActor(actor);<br>
renderer->AddActor(skybox);<br>
<br>
// renderer->SetBackground(.3, .6, .3); // Background color green<br>
<br>
renderWindow->Render();<br>
renderWindowInteractor->Start(<wbr>);<br>
<br>
return EXIT_SUCCESS;<br>
}<br>
*<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
--<br>
Sent from: <a href="http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html" rel="noreferrer" target="_blank">http://vtk.1045678.n5.nabble.<wbr>com/VTK-Users-f1224199.html</a><br>
______________________________<wbr>_________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK_<wbr>FAQ</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=<wbr>vtkusers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="https://vtk.org/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">https://vtk.org/mailman/<wbr>listinfo/vtkusers</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Ken Martin PhD<div>Distinguished Engineer<br><span style="font-size:12.8px">Kitware Inc.</span><br></div><div>28 Corporate Drive<br>Clifton Park NY 12065<br><div><br></div><div><span style="font-size:10pt;font-family:Tahoma,sans-serif">This communication,
including all attachments, contains confidential and legally privileged
information, and it is intended only for the use of the addressee. Access to this email by anyone else is
unauthorized. If you are not the intended recipient, any disclosure, copying,
distribution or any action taken in reliance on it is prohibited and may be
unlawful. If you received this communication in error please notify us
immediately and destroy the original message.
Thank you.</span></div></div></div></div></div>
</div>