# Sample Code: Zebra Striping

**URL:** <https://forum.techsoft3d.com/t/sample-code-zebra-striping/1488>\
**Category:** HOOPS Visualize Desktop\
**Tags:** code, sample, knowledge-base, texture\
**Created:** [July 19, 2022, 4:00am UTC](https://forum.techsoft3d.com/t/sample-code-zebra-striping/1488 "2022-07-19T04:00:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![gabriel.peragine](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.techsoft3d.com/gabriel.peragine/32/1535_2.png) [@gabriel.peragine](https://forum.techsoft3d.com/u/gabriel.peragine)\
**Post date:** [July 19, 2022, 4:00am UTC](https://forum.techsoft3d.com/t/sample-code-zebra-striping/1488/1 "2022-07-19T04:00:00Z")

</div>

**Version:** HPS 2022  
**Language:** C++  
**Description:**

This sample code shows how to apply Zebra Striping using `Channel::EnvironmentTexture` with `Parameterization::ReflectionVector`

```auto
void CHPSView::OnUserCode()
{
	HPS::SegmentKey modelKey = GetCanvas().GetFrontView().GetAttachedModel().GetSegmentKey();
	ImageKit imageKit;
	
	UTF8 file_in = "zebra.jpg";
	Image::ImportOptionsKit importOptionsKit;
	importOptionsKit.SetFormat(Image::Format::Jpeg);
	imageKit = Image::File::Import(static_cast<const char*>(file_in), importOptionsKit);

	PortfolioKeyArray portfolios;
	PortfolioKey pKey;
	ImageDefinition imageDefinition;
	TextureOptionsKit textureOptionsKit;

	modelKey.GetPortfolioControl().Show(portfolios);
	pKey = portfolios[0];
	imageDefinition = pKey.DefineImage("zebra_texture", imageKit);

	textureOptionsKit.SetParameterizationSource(Material::Texture::Parameterization::ReflectionVector);
	pKey.DefineTexture("zebra", imageDefinition, textureOptionsKit);

	HPS::SegmentKey mySegmentKey = modelKey.Subsegment("geometry");
	HPS::CylinderKey cylinderKey = mySegmentKey.InsertCylinder(
		Point(5, 5, 10), Point(-7, -5, -10), 5, 
		HPS::Cylinder::Capping::Both);

	mySegmentKey.GetMaterialMappingControl()
		.SetFaceTexture("zebra", Material::Texture::Channel::EnvironmentTexture);

	GetCanvas().Update();
}

```

 ![2022-05-23_13-55-13](https://us1.discourse-cdn.com/flex020/uploads/techsoft3d/original/1X/f54909f018afe85ee789c2e155ba314a461e8785.png)  
 ![zebra (1)](https://us1.discourse-cdn.com/flex020/uploads/techsoft3d/original/1X/7b12b76548d8651f818af813704afa45764ca150.jpeg)
