Skip to content

Commit 5717b13

Browse files
Move part of the display initialization to the constructor
1 parent a0f5bf7 commit 5717b13

1 file changed

Lines changed: 15 additions & 25 deletions

File tree

src/Visualization/Display3d.cpp

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,21 @@
2323
Display3d::Display3d()
2424
: myIsOffscreen(false)
2525
{
26+
// Create graphic driver
27+
Handle(Aspect_DisplayConnection) aDisplayConnection = new Aspect_DisplayConnection();
28+
if (GetGraphicDriver().IsNull())
29+
{
30+
GetGraphicDriver() = new OpenGl_GraphicDriver (aDisplayConnection);
31+
}
32+
33+
// Create V3dViewer and V3d_View
34+
myV3dViewer = new V3d_Viewer(GetGraphicDriver(), (short* const)"viewer");
35+
36+
// Create AISInteractiveViewer
37+
myAISContext = new AIS_InteractiveContext(myV3dViewer);
38+
39+
// Create view
40+
myV3dView = myV3dViewer->CreateView();
2641
}
2742

2843
Display3d::~Display3d()
@@ -110,7 +125,6 @@ Standard_Boolean Display3d::SetSize(int size_x, int size_y)
110125
myWindow = new Cocoa_Window("Python OCC",
111126
0, 0,
112127
size_x, size_y);
113-
printf("Cocoa window created.\n");
114128
myWindow->SetVirtual (true);
115129
#else
116130
myWindow = new Xw_Window (myAISContext->CurrentViewer()->Driver()->GetDisplayConnection(),
@@ -153,41 +167,17 @@ Standard_Boolean Display3d::GetImageData(const char* &data, size_t &size, const
153167

154168
void Display3d::Init(long window_handle)
155169
{
156-
printf(" ###### 3D rendering pipe initialisation #####\n");
157-
printf("Display3d class initialization starting ...\n");
158-
// Create graphic driver
159-
Handle(Aspect_DisplayConnection) aDisplayConnection = new Aspect_DisplayConnection();
160-
printf("Aspect_DisplayConnection created.\n");
161-
if (GetGraphicDriver().IsNull())
162-
{
163-
GetGraphicDriver() = new OpenGl_GraphicDriver (aDisplayConnection);
164-
}
165-
printf("Graphic_Driver created.\n");
166-
// Create V3dViewer and V3d_View
167-
myV3dViewer = new V3d_Viewer(GetGraphicDriver(), (short* const)"viewer");
168-
printf("V3d_Viewer created.\n");
169-
// Create AISInteractiveViewer
170-
myAISContext = new AIS_InteractiveContext(myV3dViewer);
171-
printf("AIS_InteractiveContext created.\n");
172-
// Create view
173-
myV3dView = myV3dViewer->CreateView();
174-
printf("V3d_View created\n");
175170
// Create Graphic Window
176171
#ifdef WNT
177172
myWindow = new WNT_Window((Aspect_Handle) window_handle);
178-
printf("WNT window created.\n");
179173
#elif defined(__APPLE__) && !defined(MACOSX_USE_GLX)
180174
myWindow = new Cocoa_Window((NSView *) window_handle);
181-
printf("Cocoa window created.\n");
182175
#else
183176
myWindow = new Xw_Window(myAISContext->CurrentViewer()->Driver()->GetDisplayConnection(),
184177
(Aspect_Handle) window_handle);
185-
printf("Xw_Window created.\n");
186178
#endif
187179
myV3dView->SetWindow(myWindow);
188180
if (!myWindow->IsMapped()) myWindow->Map();
189-
printf("Display3d class successfully initialized.\n");
190-
printf(" ########################################\n");
191181
}
192182

193183
void Display3d::ChangeRenderingParams(int Method,

0 commit comments

Comments
 (0)