반응형
[ 2010년에 작성된 글입니다. 지금은 다를 수 있습니다. ]
CAD 시스템에서 많이 사용하는 Gradient Background 표현하기.
OpenCascade 블로그를 이용하여 간단하게 구현해 보았다.
쉽게 적용은 되지만, 왠지 화면 크기 변경 시 색상이 원하는 데로 변하지는 않는 것 같다.
마치 정사각형 중에서 화면 크기만큼만 잘리는 느낌이랄까....
머 이건 나중에 좀더 보기로 하고 일단 적용..
if (aBackgroundLayer.IsNull()) {
Standard_Boolean aSizeDependant = Standard_True; //each window to have particular mapped layer?
aBackgroundLayer = new Visual3d_Layer(myView->Viewer()->Viewer(),
Aspect_TOL_UNDERLAY, aSizeDependant);
}
Rect rect;
etClientRect(&rect);
BackgroundLayer->Clear(); //make sure we draw on a clean layer
aBackgroundLayer->Begin();
aBackgroundLayer->SetViewport(rect.Width(), rect.Height());
aBackgroundLayer->BeginPolygon();
aBackgroundLayer->SetColor(Quantity_NOC_BLACK);
aBackgroundLayer->AddVertex(-1, 1);
aBackgroundLayer->AddVertex(1, 1);
aBackgroundLayer->SetColor(Quantity_NOC_WHITE);
aBackgroundLayer->AddVertex(1, -1);
aBackgroundLayer->AddVertex(-1, -1);
aBackgroundLayer->ClosePrimitive();
aBackgroundLayer->End();
반응형
'3D' 카테고리의 다른 글
[OSG] 초기 화면 비율 조정 (0) | 2021.03.13 |
---|---|
[OpenCASCADE] STL(Mesh) to Polygon 2 (0) | 2021.03.13 |
[OpenCASCADE] Shape Edge Intersection (0) | 2021.03.13 |
[OpenCASCADE] Intersection (Shape - Plane) (0) | 2021.03.13 |
[OpenCASCADE] STL(Mesh) to Polygon (0) | 2021.03.13 |