MCPcopy Create free account
hub / github.com/cogentcore/core / renderWindow

Method renderWindow

core/renderwindow.go:744–775  ·  view source on GitHub ↗

renderWindow performs all rendering based on current Stages config. It sets the Write lock on RenderContext Mutex, so nothing else can update during this time. All other updates are done with a Read lock so they won't interfere with each other.

()

Source from the content-addressed store, hash-verified

742// during this time. All other updates are done with a Read lock so they
743// won't interfere with each other.
744func (w *renderWindow) renderWindow() {
745 rc := w.renderContext()
746 rc.lock()
747 defer func() {
748 rc.rebuild = false
749 rc.unlock()
750 }()
751 rebuild := rc.rebuild
752
753 stageMods, sceneMods := w.mains.updateAll() // handles all Scene / Widget updates!
754 top := w.mains.top()
755 if top == nil {
756 return
757 }
758 if !top.Sprites.Modified && !rebuild && !stageMods && !sceneMods { // nothing to do!
759 // fmt.Println("no mods") // note: get a ton of these..
760 return
761 }
762
763 if DebugSettings.WinRenderTrace {
764 fmt.Println("RenderWindow: doing render:", w.name)
765 fmt.Println("rebuild:", rebuild, "stageMods:", stageMods, "sceneMods:", sceneMods)
766 }
767
768 if stageMods || rebuild {
769 if !w.gatherScenes() {
770 slog.Error("RenderWindow: no scenes")
771 return
772 }
773 }
774 w.drawScenes()
775}
776
777// drawScenes does the drawing of RenderScenes to the window.
778func (w *renderWindow) drawScenes() {

Callers 1

handleWindowEventsMethod · 0.95

Calls 9

renderContextMethod · 0.95
gatherScenesMethod · 0.95
drawScenesMethod · 0.95
lockMethod · 0.80
unlockMethod · 0.80
updateAllMethod · 0.80
topMethod · 0.80
PrintlnMethod · 0.80
ErrorMethod · 0.65

Tested by

no test coverage detected