Below is sample code that uses custom shaders to change color and make a small shift on position of edges. This code was tested on HOOPS 3DF 30.40
Sample Code:
void CSolidHoopsView::OnExtraSlot4() {
static char const ps_source[] = { "void custom_main(inout PixelShaderContext ctx) { \n"
"\tctx.poutput.FinalColor = float4(1.0, 0.0, 0.0, 0.0);\n"
"}\n\n" };
static char const vs_source[] = { "void custom_main(inout VertexShaderContext ctx) { \n"
"\tctx.voutput.position.x += 0.25f;\n"
"}\n\n" };
HPoint spts[5];
int facelist[5];
spts[0].x = -0.5f; spts[0].y = -0.5f; spts[0].z = 0.0f;
spts[1].x = 0.5f; spts[1].y = -0.5f; spts[1].z = 0.0f;
spts[2].x = 0.5f; spts[2].y = 0.5f; spts[2].z = 0.0f;
spts[3].x = -0.5f; spts[3].y = 0.5f; spts[3].z = 0.0f;
spts[4].x = -0.5f; spts[4].y = -0.5f; spts[4].z = 0.0f;
facelist[0] = 4; facelist[1] = 0; facelist[2] = 1; facelist[3] = 2;
facelist[4] = 3;
HC_Open_Segment_By_Key(m_pHView->GetModelKey()); {
HC_Open_Segment("geometry"); {
HC_KEY shader_1 = HC_Define_Shader("shader_1", "vertex", vs_source);
HC_KEY shader_2 = HC_Define_Shader("shader_2", "pixel", ps_source);
HC_Set_Shader("lines", shader_1, shader_2);
HC_Set_Visibility("faces=on,lines=on");
HC_Insert_Shell (4, spts, 5, facelist);
HC_Insert_Polyline(5, spts);
} HC_Close_Segment();
} HC_Close_Segment();
m_pHView->Update();
}
