octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #63051] Reparented graphics objects may be dra


From: Markus Mützel
Subject: [Octave-bug-tracker] [bug #63051] Reparented graphics objects may be drawn in wrong order
Date: Mon, 19 Sep 2022 06:07:59 -0400 (EDT)

Follow-up Comment #7, bug #63051 (project octave):

Thanks for tracking this down.
I was half expecting that this might be caused by some changes when `light`
was added. IIRC, I had to touch the order in which objects are drawn to get
the light source early enough when rendering.

I don't understand immediately how the changeset that Rik found affects the
order in which objects are drawn though.
IIUC, that drawing is done in `opengl_renderer::draw_axes_children`:
https://hg.savannah.gnu.org/hgweb/octave/file/6646f2b5a3d1/libinterp/corefcn/gl-render.cc#l2210

Lines (including those in hggroups) should be drawn in "group #3":

   // 3rd pass: draw remaining objects

    m_glfcns.glDisable (GL_DEPTH_TEST);

    for (it = obj_list.begin (); it != obj_list.end (); it++)
      {
        graphics_object go = (*it);

        set_clipping (go.get_properties ().is_clipping ());
        draw (go);
      }

    set_clipping (false);


`obj_list` is populated here:
https://hg.savannah.gnu.org/hgweb/octave/file/6646f2b5a3d1/libinterp/corefcn/gl-render.cc#l2163

  void
  opengl_renderer::draw_all_lights (const base_properties& props,
                                    std::list<graphics_object>& obj_list)
  {
#if defined (HAVE_OPENGL)
    gh_manager& gh_mgr = __get_gh_manager__ ();

    Matrix children = props.get_all_children ();

    for (octave_idx_type i = children.numel () - 1; i >= 0; i--)
      {
        graphics_object go = gh_mgr.get_object (children(i));

        base_properties p = go.get_properties ();

        if (p.is_visible ()
            || (m_selecting && p.pickableparts_is ("all")))
          {
            if (go.isa ("light") && ! m_selecting)
              {
                if (m_current_light-GL_LIGHT0 < m_max_lights)
                  {
                    set_clipping (p.is_clipping ());
                    draw (go);
                    m_current_light++;
                  }
              }
            else if (go.isa ("hggroup")
                     && ! (m_selecting && p.pickableparts_is ("none")))
              draw_all_lights (go.get_properties (), obj_list);
            else if (! (m_selecting && p.pickableparts_is ("none")))
              obj_list.push_back (go);
          }
      }
#else

    octave_unused_parameter (props);
    octave_unused_parameter (obj_list);

    // This shouldn't happen because construction of opengl_renderer
    // objects is supposed to be impossible if OpenGL is not available.

    panic_impossible ();

#endif
  }


I'm not sure how any of this can be affected by the changeset that Rik
found...


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?63051>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]