# Priority HSRA simple example

**URL:** <https://forum.techsoft3d.com/t/priority-hsra-simple-example/4035>\
**Category:** HOOPS Visualize Desktop\
**Tags:** code, knowledge-base, how-to\
**Created:** [September 17, 2024, 9:13pm UTC](https://forum.techsoft3d.com/t/priority-hsra-simple-example/4035 "2024-09-17T21:13:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![simon](https://avatars.discourse-cdn.com/v4/letter/s/f07891/32.png) [@simon](https://forum.techsoft3d.com/u/simon)\
**Post date:** [September 17, 2024, 9:13pm UTC](https://forum.techsoft3d.com/t/priority-hsra-simple-example/4035/1 "2024-09-17T21:13:16Z")

</div>

The following is a simple example on how to use “priority HSRA”.

```auto
	HC_Open_Segment_By_Key(m_pHView->GetViewKey()); {
		HC_Set_Rendering_Options("hsra = priority");
	}HC_Close_Segment();

```

The “priority” hidden surface removal algorithm is primarily used for creating layers within 2D scenes and can cause undesired results when rendering non-planar objects, such as shells or meshes, that can have some parts overlapping others within the same primitive.

```auto
void CSolidHoopsView::OnExtraSlot1() {

	HC_Open_Segment_By_Key(m_pHView->GetViewKey()); {
		HC_Set_Rendering_Options("hsra = priority");
	}HC_Close_Segment();

	float points[12] = { -1, -1, 0, -1, 1, 0, 1, 1, 0, 1, -1, 0 };
	int face_lists[5] = { 4, 0, 1, 2, 3 };

	HC_Open_Segment_By_Key(m_pHView->GetModelKey()); {
		HC_Set_Visibility("faces=on,lines=on");

		HC_Open_Segment("line"); 
		HC_KEY lineKey = HC_Insert_Line(-2, -0.5f, 0, 2, -0.5f, 0);
		HC_Close_Segment();
		HC_Set_Priority(lineKey, 99);

		HC_Open_Segment("line2");
		HC_KEY lineKey2 = HC_Insert_Line(-2, 0.5f, 0, 2, 0.5, 0);
		HC_Close_Segment();
		HC_Set_Priority(lineKey2, 101);

		HC_Open_Segment("shell");
		HC_KEY shellKey = HC_Insert_Shell(4, points, 5, face_lists);
		HC_Close_Segment();
		HC_Set_Priority(shellKey, 100);
	}
	HC_Close_Segment();
	m_pHView->Update();

}

```

Screenshot:

 ![2024-09-17_14-12-29](https://us1.discourse-cdn.com/flex020/uploads/techsoft3d/original/2X/f/f47a38761c7e47300e0ec6b46b8fb83f683c7656.png)
