Le 31 mars 2014 à 14:35, Václav Štěpán <vaclav.stepan@odz.ujf.cas.cz> a écrit : (...) the color of the HeadTime text changes, seeming depending on the last object drawn (in the physics stage, those are the yellow step points, in chemistry it depends on what type of radical is the last one drawn). The displayHeadTime accepts color parameter - I tried this: /vis/ogl/set/displayHeadTime true -0.1 -0.8 24 1.0 0.0 0.0 But the color setting does not get applied. In G4OpenGLStoredViewer::DrawDisplayLists the parameters are set and passed further, but at some point they aren't used. Setting TextColour manually in between time slice steps does not work, as that's overriden by further drawings. The system configuration is Geant4 10.0 with patch 1, Qt, OpenGL driver. I'd be happy to provide whatever help necessary to debug the issue. Thank you very much for your time and help. Yours sincerely, Vaclav Stepan -- Université Bordeaux 1, CNRS/IN2P3, CENBG, Gradignan, France Department of Radiation Dosimetry, Nuclear Physics Institute ASCR, Prague, Czech Republic
For information : Le 10 avr. 2014 à 13:24, Václav Štěpán <vaclav.stepan@odz.ujf.cas.cz> a écrit : (...) >> Just an idea—can it be, that the text color is not set, because the head time text is not a SceneTreeElement? In fact, in case of head time text, the color was never set in Qt (should check X and Win32). It was always taking the last color drawn. Try that by : /vis/ogl/set/displayHeadTime true -0.1 -0.8 24 0.7 0.2 0.7 >> Because—John's right that the color = fSceneHandler.GetTextColour(g4Text); would indeed retrieve the right color (checked that). Yes >> But the G4OpenGLQtViewer::addNonPVSceneTreeElement is not called during time slice sequence (checked by adding a G4cout in the addNonPVSceneTreeElement). The call sequence is : G4OpenGLStoredQtViewer::ComputeView() { … ProcessView() => addNonPVSceneTreeElement() & addPVSceneTreeElement() <—— create display lists … DrawDisplayLists() => DrawText() for head time text) <—— draw display lists & draw text … } Head time text is draw after all display lists, but normal text is draw during display list call. In case of normal text, color is set just before we draw it. In case of head time text, the color was never set (except in X driver where the color was set directly in DrawText() ) Then the best solution I guess to solve this, is to do what we do in X driver, then : in G4OpenGLQtViewer::DrawText() add : const G4Colour& c = fSceneHandler.GetTextColour(g4text); glColor4d(c.GetRed(),c.GetGreen(),c.GetBlue(),c.GetAlpha()); before : G4Point3D position = g4text.GetPosition(); And review a bit text drawing, colors and transparency management in G4OpenGLStoredViewer::DrawDisplayLists () Cheers, Laurent