1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 | |
9 | |
10 | |
11 | |
12 | |
13 | |
14 | |
15 | |
16 | |
17 | |
18 | |
19 | |
20 | |
21 | |
22 | |
23 | |
24 | |
25 | |
26 | |
27 | |
28 | |
29 | |
30 | |
31 | |
32 | |
33 | #ifdef G4VIS_BUILD_OPENGL_DRIVER1 |
34 | |
35 | #include "G4OpenGLStoredSceneHandler.hh" |
36 | |
37 | #include "G4PhysicalVolumeModel.hh" |
38 | #include "G4LogicalVolumeModel.hh" |
39 | #include "G4VPhysicalVolume.hh" |
40 | #include "G4LogicalVolume.hh" |
41 | #include "G4Polyline.hh" |
42 | #include "G4Polymarker.hh" |
43 | #include "G4Text.hh" |
44 | #include "G4Circle.hh" |
45 | #include "G4Square.hh" |
46 | #include "G4Polyhedron.hh" |
47 | #include "G4AttHolder.hh" |
48 | #include "G4OpenGLTransform3D.hh" |
49 | #include "G4OpenGLViewer.hh" |
50 | #include "G4AttHolder.hh" |
51 | |
52 | #include <typeinfo> |
53 | |
54 | G4int G4OpenGLStoredSceneHandler::fSceneIdCount = 0; |
55 | |
56 | G4int G4OpenGLStoredSceneHandler::fDisplayListId = 0; |
57 | G4bool G4OpenGLStoredSceneHandler::fMemoryForDisplayLists = true; |
58 | G4int G4OpenGLStoredSceneHandler::fDisplayListLimit = 50000; |
59 | |
60 | G4OpenGLStoredSceneHandler::PO::PO(): |
61 | fDisplayListId(0), |
62 | fPickName(0), |
63 | fpG4TextPlus(0), |
64 | fMarkerOrPolyline(false) |
65 | {} |
66 | |
67 | G4OpenGLStoredSceneHandler::PO::PO(const G4OpenGLStoredSceneHandler::PO& po): |
68 | fDisplayListId(po.fDisplayListId), |
69 | fTransform(po.fTransform), |
70 | fPickName(po.fPickName), |
71 | fColour(po.fColour), |
72 | fpG4TextPlus(po.fpG4TextPlus? new G4TextPlus(*po.fpG4TextPlus): 0), |
73 | fMarkerOrPolyline(po.fMarkerOrPolyline) |
74 | {} |
75 | |
76 | G4OpenGLStoredSceneHandler::PO::PO(G4int id, const G4Transform3D& tr): |
77 | fDisplayListId(id), |
78 | fTransform(tr), |
79 | fPickName(0), |
80 | fpG4TextPlus(0), |
81 | fMarkerOrPolyline(false) |
82 | {} |
83 | |
84 | G4OpenGLStoredSceneHandler::PO::~PO() |
85 | { |
86 | delete fpG4TextPlus; |
87 | } |
88 | |
89 | G4OpenGLStoredSceneHandler::PO& G4OpenGLStoredSceneHandler::PO::operator= |
90 | (const G4OpenGLStoredSceneHandler::PO& rhs) |
91 | { |
92 | if (&rhs == this) return *this; |
93 | fDisplayListId = rhs.fDisplayListId; |
94 | fTransform = rhs.fTransform; |
95 | fPickName = rhs.fPickName; |
96 | fColour = rhs.fColour; |
97 | fpG4TextPlus = rhs.fpG4TextPlus? new G4TextPlus(*rhs.fpG4TextPlus): 0; |
98 | fMarkerOrPolyline = rhs.fMarkerOrPolyline; |
99 | return *this; |
100 | } |
101 | |
102 | G4OpenGLStoredSceneHandler::TO::TO(): |
103 | fDisplayListId(0), |
104 | fPickName(0), |
105 | fStartTime(-DBL_MAXstd::numeric_limits<double>::max()), |
106 | fEndTime(DBL_MAXstd::numeric_limits<double>::max()), |
107 | fpG4TextPlus(0), |
108 | fMarkerOrPolyline(false) |
109 | {} |
110 | |
111 | G4OpenGLStoredSceneHandler::TO::TO(const G4OpenGLStoredSceneHandler::TO& to): |
112 | fDisplayListId(to.fDisplayListId), |
113 | fTransform(to.fTransform), |
114 | fPickName(to.fPickName), |
115 | fStartTime(to.fStartTime), |
116 | fEndTime(to.fEndTime), |
117 | fColour(to.fColour), |
118 | fpG4TextPlus(to.fpG4TextPlus? new G4TextPlus(*to.fpG4TextPlus): 0), |
119 | fMarkerOrPolyline(to.fMarkerOrPolyline) |
120 | {} |
121 | |
122 | G4OpenGLStoredSceneHandler::TO::TO(G4int id, const G4Transform3D& tr): |
123 | fDisplayListId(id), |
124 | fTransform(tr), |
125 | fPickName(0), |
126 | fStartTime(-DBL_MAXstd::numeric_limits<double>::max()), |
127 | fEndTime(DBL_MAXstd::numeric_limits<double>::max()), |
128 | fpG4TextPlus(0), |
129 | fMarkerOrPolyline(false) |
130 | {} |
131 | |
132 | G4OpenGLStoredSceneHandler::TO::~TO() |
133 | { |
134 | delete fpG4TextPlus; |
135 | } |
136 | |
137 | G4OpenGLStoredSceneHandler::TO& G4OpenGLStoredSceneHandler::TO::operator= |
138 | (const G4OpenGLStoredSceneHandler::TO& rhs) |
139 | { |
140 | if (&rhs == this) return *this; |
141 | fDisplayListId = rhs.fDisplayListId; |
142 | fTransform = rhs.fTransform; |
143 | fPickName = rhs.fPickName; |
144 | fStartTime = rhs.fStartTime; |
145 | fEndTime = rhs.fEndTime; |
146 | fColour = rhs.fColour; |
147 | fpG4TextPlus = rhs.fpG4TextPlus? new G4TextPlus(*rhs.fpG4TextPlus): 0; |
148 | fMarkerOrPolyline = rhs.fMarkerOrPolyline; |
149 | return *this; |
150 | } |
151 | |
152 | G4OpenGLStoredSceneHandler::G4OpenGLStoredSceneHandler |
153 | (G4VGraphicsSystem& system, |
154 | const G4String& name): |
155 | G4OpenGLSceneHandler (system, fSceneIdCount++, name), |
156 | fTopPODL (0) |
157 | {} |
158 | |
159 | G4OpenGLStoredSceneHandler::~G4OpenGLStoredSceneHandler () |
160 | {} |
161 | |
162 | void G4OpenGLStoredSceneHandler::BeginPrimitives |
163 | (const G4Transform3D& objectTransformation) |
164 | { |
165 | G4OpenGLSceneHandler::BeginPrimitives (objectTransformation); |
166 | if (fReadyForTransients) glDrawBuffer (GL_FRONT0x0404); |
167 | |
168 | } |
169 | |
170 | void G4OpenGLStoredSceneHandler::EndPrimitives () |
171 | { |
172 | |
173 | ScaledFlush(); |
174 | glDrawBuffer (GL_BACK0x0405); |
175 | G4OpenGLSceneHandler::EndPrimitives (); |
176 | } |
177 | |
178 | void G4OpenGLStoredSceneHandler::BeginPrimitives2D |
179 | (const G4Transform3D& objectTransformation) |
180 | { |
181 | G4OpenGLSceneHandler::BeginPrimitives2D(objectTransformation); |
182 | if (fReadyForTransients) glDrawBuffer (GL_FRONT0x0404); |
183 | } |
184 | |
185 | void G4OpenGLStoredSceneHandler::EndPrimitives2D () |
186 | { |
187 | |
188 | ScaledFlush(); |
189 | glDrawBuffer (GL_BACK0x0405); |
190 | G4OpenGLSceneHandler::EndPrimitives2D (); |
191 | } |
192 | |
193 | G4bool G4OpenGLStoredSceneHandler::AddPrimitivePreamble(const G4VMarker& visible) |
194 | { |
195 | return AddPrimitivePreambleInternal(visible, true, false); |
196 | } |
197 | G4bool G4OpenGLStoredSceneHandler::AddPrimitivePreamble(const G4Polyline& visible) |
198 | { |
199 | return AddPrimitivePreambleInternal(visible, false, true); |
200 | } |
201 | G4bool G4OpenGLStoredSceneHandler::AddPrimitivePreamble(const G4Polyhedron& visible) |
202 | { |
203 | return AddPrimitivePreambleInternal(visible, false, false); |
204 | } |
205 | |
206 | G4bool G4OpenGLStoredSceneHandler::AddPrimitivePreambleInternal(const G4Visible& visible, bool isMarker, bool isPolyline) |
207 | { |
208 | |
209 | fpVisAttribs = fpViewer->GetApplicableVisAttributes(visible.GetVisAttributes()); |
210 | const G4Colour& c = GetColour (); |
211 | G4double opacity = c.GetAlpha (); |
212 | |
213 | G4bool transparency_enabled = true; |
214 | G4bool isMarkerNotHidden = true; |
215 | G4OpenGLViewer* pViewer = dynamic_cast<G4OpenGLViewer*>(fpViewer); |
| 1 | 'pViewer' initialized here | |
|
216 | if (pViewer) { |
| 2 | | Assuming 'pViewer' is null | |
|
| |
217 | transparency_enabled = pViewer->transparency_enabled; |
218 | isMarkerNotHidden = pViewer->fVP.IsMarkerNotHidden(); |
219 | } |
220 | |
221 | G4bool isTransparent = opacity < 1.; |
222 | G4bool isMarkerOrPolyline = isMarker || isPolyline; |
223 | G4bool treatAsTransparent = transparency_enabled && isTransparent; |
224 | G4bool treatAsNotHidden = isMarkerNotHidden && isMarkerOrPolyline; |
225 | |
226 | if (fProcessing2D) glDisable (GL_DEPTH_TEST0x0B71); |
| |
227 | else { |
228 | if (isMarkerOrPolyline && isMarkerNotHidden) |
229 | glDisable (GL_DEPTH_TEST0x0B71); |
230 | else {glEnable (GL_DEPTH_TEST0x0B71); glDepthFunc (GL_LEQUAL0x0203);} |
231 | } |
232 | |
233 | if (fThreePassCapable) { |
| |
234 | |
235 | |
236 | |
237 | |
238 | if (!(fSecondPassForTransparency || fThirdPassForNonHiddenMarkers)) { |
239 | |
240 | if (treatAsTransparent) { |
241 | fSecondPassForTransparencyRequested = true; |
242 | } |
243 | if (treatAsNotHidden) { |
244 | fThirdPassForNonHiddenMarkersRequested = true; |
245 | } |
246 | |
247 | if (treatAsTransparent || treatAsNotHidden) { |
248 | return false; |
249 | } |
250 | } |
251 | |
252 | |
253 | if (fSecondPassForTransparency) { |
254 | if (!treatAsTransparent) { |
255 | return false; |
256 | } |
257 | } |
258 | |
259 | |
260 | if (fThirdPassForNonHiddenMarkers) { |
261 | if (!treatAsNotHidden) { |
262 | return false; |
263 | |
264 | } |
265 | } |
266 | } |
267 | |
268 | |
269 | G4bool isPicking = false; |
270 | if (fpViewer->GetViewParameters().IsPicking()) { |
| |
271 | isPicking = true; |
272 | glLoadName(++fPickName); |
273 | G4AttHolder* holder = new G4AttHolder; |
274 | LoadAtts(visible, holder); |
275 | fPickMap[fPickName] = holder; |
276 | } |
277 | |
278 | |
279 | const G4VSolid* pSolid = 0; |
280 | G4PhysicalVolumeModel* pPVModel = |
281 | dynamic_cast<G4PhysicalVolumeModel*>(fpModel); |
282 | if (fpViewer->GetViewParameters().GetVisAttributesModifiers().size()) |
| |
283 | |
284 | goto end_of_display_list_reuse_test; |
285 | if (pPVModel) { |
| 8 | | Assuming 'pPVModel' is non-null | |
|
| |
286 | |
287 | |
288 | G4LogicalVolumeModel* pLVModel = |
289 | dynamic_cast<G4LogicalVolumeModel*>(pPVModel); |
290 | if (pLVModel) |
| 10 | | Assuming 'pLVModel' is null | |
|
| |
291 | |
292 | goto end_of_display_list_reuse_test; |
293 | if (pViewer->fVP.IsSection() || pViewer->fVP.IsCutaway()) |
| 12 | | Called C++ object pointer is null |
|
294 | |
295 | goto end_of_display_list_reuse_test; |
296 | |
297 | |
298 | |
299 | |
300 | |
301 | G4VPhysicalVolume* pPV = pPVModel->GetCurrentPV(); |
302 | if (!pPV) |
303 | |
304 | goto end_of_display_list_reuse_test; |
305 | G4LogicalVolume* pLV = pPV->GetLogicalVolume(); |
306 | if (!pLV) |
307 | |
308 | goto end_of_display_list_reuse_test; |
309 | pSolid = pLV->GetSolid(); |
310 | EAxis axis = kRho; |
311 | G4VPhysicalVolume* pCurrentPV = pPVModel->GetCurrentPV(); |
312 | if (pCurrentPV -> IsReplicated ()) { |
313 | G4int nReplicas; |
314 | G4double width; |
315 | G4double offset; |
316 | G4bool consuming; |
317 | pCurrentPV->GetReplicationData(axis,nReplicas,width,offset,consuming); |
318 | } |
319 | |
320 | |
321 | if (!(pCurrentPV -> IsParameterised ()) && |
322 | |
323 | |
324 | !(pCurrentPV -> IsReplicated () && axis == kRho) && |
325 | |
326 | (fSolidMap.find (pSolid) != fSolidMap.end ())) { |
327 | fDisplayListId = fSolidMap [pSolid]; |
328 | PO po(fDisplayListId,fObjectTransformation); |
329 | if (isPicking) po.fPickName = fPickName; |
330 | po.fColour = c; |
331 | po.fMarkerOrPolyline = isMarkerOrPolyline; |
332 | fPOList.push_back(po); |
333 | |
334 | |
335 | |
336 | |
337 | (void) ExtraPOProcessing(G4Visible(), fPOList.size() - 1); |
338 | return false; |
339 | } |
340 | } |
341 | end_of_display_list_reuse_test: |
342 | |
343 | |
344 | |
345 | |
346 | |
347 | if (fMemoryForDisplayLists) { |
348 | fDisplayListId = glGenLists (1); |
349 | if (glGetError() == GL_OUT_OF_MEMORY0x0505 || |
350 | fDisplayListId > fDisplayListLimit) { |
351 | G4cout(*G4cout_p) << |
352 | "********************* WARNING! ********************" |
353 | "\n* Display list limit reached in OpenGL." |
354 | "\n* Continuing drawing WITHOUT STORING. Scene only partially refreshable." |
355 | "\n* Current limit: " << fDisplayListLimit << |
356 | ". Change with \"/vis/ogl/set/displayListLimit\"." |
357 | "\n***************************************************" |
358 | << G4endlstd::endl; |
359 | fMemoryForDisplayLists = false; |
360 | } |
361 | } |
362 | |
363 | if (pSolid) fSolidMap [pSolid] = fDisplayListId; |
364 | |
365 | if (fMemoryForDisplayLists) { |
366 | if (fReadyForTransients) { |
367 | TO to(fDisplayListId, fObjectTransformation); |
368 | if (isPicking) to.fPickName = fPickName; |
369 | to.fColour = c; |
370 | to.fStartTime = fpVisAttribs->GetStartTime(); |
371 | to.fEndTime = fpVisAttribs->GetEndTime(); |
372 | to.fMarkerOrPolyline = isMarkerOrPolyline; |
373 | fTOList.push_back(to); |
374 | |
375 | |
376 | |
377 | |
378 | |
379 | glPushMatrix(); |
380 | G4OpenGLTransform3D oglt (fObjectTransformation); |
381 | glMultMatrixd (oglt.GetGLMatrix ()); |
382 | if (transparency_enabled) { |
383 | glColor4d(c.GetRed(),c.GetGreen(),c.GetBlue(),c.GetAlpha()); |
384 | } else { |
385 | glColor3d(c.GetRed(),c.GetGreen(),c.GetBlue()); |
386 | } |
387 | (void) ExtraTOProcessing(visible, fTOList.size() - 1); |
388 | |
389 | |
390 | |
391 | glNewList (fDisplayListId, GL_COMPILE_AND_EXECUTE0x1301); |
392 | } else { |
393 | PO po(fDisplayListId, fObjectTransformation); |
394 | if (isPicking) po.fPickName = fPickName; |
395 | po.fColour = c; |
396 | po.fMarkerOrPolyline = isMarkerOrPolyline; |
397 | fPOList.push_back(po); |
398 | |
399 | |
400 | |
401 | |
402 | |
403 | if (transparency_enabled) { |
404 | glColor4d(c.GetRed(),c.GetGreen(),c.GetBlue(),c.GetAlpha()); |
405 | } else { |
406 | glColor3d(c.GetRed(),c.GetGreen(),c.GetBlue()); |
407 | } |
408 | G4bool usesGLCommands = ExtraPOProcessing(visible, fPOList.size() - 1); |
409 | |
410 | |
411 | |
412 | |
413 | |
414 | |
415 | |
416 | |
417 | |
418 | if (!usesGLCommands) return false; |
419 | glNewList (fDisplayListId, GL_COMPILE0x1300); |
420 | } |
421 | } else { |
422 | glPushMatrix(); |
423 | G4OpenGLTransform3D oglt (fObjectTransformation); |
424 | glMultMatrixd (oglt.GetGLMatrix ()); |
425 | if (transparency_enabled) { |
426 | glColor4d(c.GetRed(),c.GetGreen(),c.GetBlue(),c.GetAlpha()); |
427 | } else { |
428 | glColor3d(c.GetRed(),c.GetGreen(),c.GetBlue()); |
429 | } |
430 | } |
431 | |
432 | if (fProcessing2D) { |
433 | |
434 | |
435 | glMatrixMode (GL_PROJECTION0x1701); |
436 | glPushMatrix(); |
437 | glLoadIdentity(); |
438 | if (pViewer) { |
439 | pViewer->g4GlOrtho (-1., 1., -1., 1., -G4OPENGL_FLT_BIG1.e20, G4OPENGL_FLT_BIG1.e20); |
440 | } |
441 | glMatrixMode (GL_MODELVIEW0x1700); |
442 | glPushMatrix(); |
443 | glLoadIdentity(); |
444 | G4OpenGLTransform3D oglt (fObjectTransformation); |
445 | glMultMatrixd (oglt.GetGLMatrix ()); |
446 | glDisable (GL_LIGHTING0x0B50); |
447 | } else { |
448 | glEnable (GL_LIGHTING0x0B50); |
449 | } |
450 | |
451 | return true; |
452 | } |
453 | |
454 | void G4OpenGLStoredSceneHandler::AddPrimitivePostamble() |
455 | { |
456 | if (fProcessing2D) { |
457 | |
458 | glMatrixMode (GL_PROJECTION0x1701); |
459 | glPopMatrix(); |
460 | glMatrixMode (GL_MODELVIEW0x1700); |
461 | glPopMatrix(); |
462 | } |
463 | |
464 | |
465 | if (glGetError() == GL_OUT_OF_MEMORY0x0505) { |
466 | G4cerr(*G4cerr_p) << |
467 | "ERROR: G4OpenGLStoredSceneHandler::AddPrimitivePostamble: Failure" |
468 | " to allocate display List for fTopPODL - try OpenGL Immediated mode." |
469 | << G4endlstd::endl; |
470 | } |
471 | if (fMemoryForDisplayLists) { |
472 | glEndList(); |
473 | if (glGetError() == GL_OUT_OF_MEMORY0x0505) { |
474 | G4cerr(*G4cerr_p) << |
475 | "ERROR: G4OpenGLStoredSceneHandler::AddPrimitivePostamble: Failure" |
476 | " to allocate display List for fTopPODL - try OpenGL Immediated mode." |
477 | << G4endlstd::endl; |
478 | } |
479 | } |
480 | if (fReadyForTransients || !fMemoryForDisplayLists) { |
481 | glPopMatrix(); |
482 | } |
483 | } |
484 | |
485 | void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Polyline& polyline) |
486 | { |
487 | G4bool furtherprocessing = AddPrimitivePreamble(polyline); |
488 | if (furtherprocessing) { |
489 | G4OpenGLSceneHandler::AddPrimitive(polyline); |
490 | AddPrimitivePostamble(); |
491 | } |
492 | } |
493 | |
494 | void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Polymarker& polymarker) |
495 | { |
496 | G4bool furtherprocessing = AddPrimitivePreamble(polymarker); |
497 | if (furtherprocessing) { |
498 | G4OpenGLSceneHandler::AddPrimitive(polymarker); |
499 | AddPrimitivePostamble(); |
500 | } |
501 | } |
502 | |
503 | void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Text& text) |
504 | { |
505 | |
506 | |
507 | |
508 | G4bool furtherprocessing = AddPrimitivePreamble(text); |
509 | if (furtherprocessing) { |
510 | G4OpenGLSceneHandler::AddPrimitive(text); |
511 | AddPrimitivePostamble(); |
512 | } |
513 | } |
514 | |
515 | void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Circle& circle) |
516 | { |
517 | G4bool furtherprocessing = AddPrimitivePreamble(circle); |
518 | if (furtherprocessing) { |
519 | G4OpenGLSceneHandler::AddPrimitive(circle); |
520 | AddPrimitivePostamble(); |
521 | } |
522 | } |
523 | |
524 | void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Square& square) |
525 | { |
526 | G4bool furtherprocessing = AddPrimitivePreamble(square); |
527 | if (furtherprocessing) { |
528 | G4OpenGLSceneHandler::AddPrimitive(square); |
529 | AddPrimitivePostamble(); |
530 | } |
531 | } |
532 | |
533 | void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Scale& scale) |
534 | { |
535 | |
536 | G4OpenGLSceneHandler::AddPrimitive(scale); |
537 | } |
538 | |
539 | void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Polyhedron& polyhedron) |
540 | { |
541 | |
542 | |
543 | |
544 | G4bool furtherprocessing = AddPrimitivePreamble(polyhedron); |
545 | if (furtherprocessing) { |
546 | G4OpenGLSceneHandler::AddPrimitive(polyhedron); |
547 | AddPrimitivePostamble(); |
548 | } |
549 | } |
550 | |
551 | void G4OpenGLStoredSceneHandler::BeginModeling () { |
552 | G4VSceneHandler::BeginModeling(); |
553 | |
554 | |
555 | |
556 | |
557 | } |
558 | |
559 | void G4OpenGLStoredSceneHandler::EndModeling () { |
560 | |
561 | fTopPODL = glGenLists (1); |
562 | if (glGetError() == GL_OUT_OF_MEMORY0x0505) { |
563 | G4cerr(*G4cerr_p) << |
564 | "ERROR: G4OpenGLStoredSceneHandler::EndModeling: Failure to allocate" |
565 | " display List for fTopPODL - try OpenGL Immediated mode." |
566 | << G4endlstd::endl; |
567 | } else { |
568 | |
569 | glNewList (fTopPODL, GL_COMPILE0x1300); { |
570 | for (size_t i = 0; i < fPOList.size (); i++) { |
571 | glPushMatrix(); |
572 | G4OpenGLTransform3D oglt (fPOList[i].fTransform); |
573 | glMultMatrixd (oglt.GetGLMatrix ()); |
574 | if (fpViewer->GetViewParameters().IsPicking()) |
575 | glLoadName(fPOList[i].fPickName); |
576 | glCallList (fPOList[i].fDisplayListId); |
577 | glPopMatrix(); |
578 | } |
579 | } |
580 | glEndList (); |
581 | |
582 | if (glGetError() == GL_OUT_OF_MEMORY0x0505) { |
583 | G4cerr(*G4cerr_p) << |
584 | "ERROR: G4OpenGLStoredSceneHandler::EndModeling: Failure to allocate" |
585 | " display List for fTopPODL - try OpenGL Immediated mode." |
586 | << G4endlstd::endl; |
587 | } |
588 | } |
589 | |
590 | G4VSceneHandler::EndModeling (); |
591 | } |
592 | |
593 | void G4OpenGLStoredSceneHandler::ClearStore () { |
594 | |
595 | |
596 | |
597 | G4VSceneHandler::ClearStore (); |
598 | |
599 | |
600 | for (size_t i = 0; i < fPOList.size (); i++) |
601 | glDeleteLists (fPOList[i].fDisplayListId, 1); |
602 | if (fTopPODL) glDeleteLists (fTopPODL, 1); |
603 | fTopPODL = 0; |
604 | |
605 | |
606 | fPOList.clear (); |
607 | fSolidMap.clear (); |
608 | ClearAndDestroyAtts(); |
609 | |
610 | |
611 | for (size_t i = 0; i < fTOList.size (); i++) |
612 | glDeleteLists(fTOList[i].fDisplayListId, 1); |
613 | fTOList.clear (); |
614 | |
615 | fMemoryForDisplayLists = true; |
616 | } |
617 | |
618 | void G4OpenGLStoredSceneHandler::ClearTransientStore () |
619 | { |
620 | |
621 | |
622 | |
623 | for (size_t i = 0; i < fTOList.size (); i++) |
624 | glDeleteLists(fTOList[i].fDisplayListId, 1); |
625 | fTOList.clear (); |
626 | |
627 | fMemoryForDisplayLists = true; |
628 | |
629 | |
630 | if (fpViewer) { |
631 | fpViewer -> SetView (); |
632 | fpViewer -> ClearView (); |
633 | fpViewer -> DrawView (); |
634 | } |
635 | } |
636 | |
637 | |
638 | #endif |