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

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

[Octave-bug-tracker] [bug #52940] Regression with "PaperPosition" and pr


From: Dan Sebald
Subject: [Octave-bug-tracker] [bug #52940] Regression with "PaperPosition" and printing
Date: Tue, 23 Jan 2018 17:23:54 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0

Follow-up Comment #15, bug #52940 (project octave):

After quite a bit of printing out numbers, I think I'm getting close.  I just
want to write a short note here so I can pause and come back to this.

The way that Qt toolkit is setup (in on-screen mode) there are some
signal/slots that basically trigger a Figure::print, which calls
GLCanvas::print which goes back to 


  void
  opengl_renderer::draw_figure (const figure::properties& props)
  {
GLint vp[4];
glGetIntegerv (GL_VIEWPORT, vp);
std::cerr << "draw_figure viewport = " << vp[0] << " " << vp[1] << " " <<
vp[2] << " " << vp[3] << "\n";
    // Initialize OpenGL context


where I printed out the viewport.  The on-screen viewport looks correct.  But
immediately when doing the gl2ps print that viewport is wrong (see previous
posts for the numbers).

Following the program flow, I found this routine for which I printed out
similar information:


  void
  GLCanvas::draw (const graphics_handle& gh)
  {
    gh_manager::auto_lock lock;
    graphics_object go = gh_manager::get_object (gh);

    if (go)
      {
        octave::opengl_renderer r;

std::cerr << "GLCanvas::draw width " << width() << " height " << height() <<
"\n";
        r.set_viewport (width (), height ());
        r.draw (go);
      }
  }


For the first portion of on-screen draws (what I've been calling contortions),
I see:


GLCanvas::draw width 560 height 420
GLCanvas::draw width 720 height 396
GLCanvas::draw width 720 height 396
GLCanvas::draw width 720 height 396


at which point I had a bunch of pause() in place so that I knew the off-screen
gl2ps_print hadn't occurred yet.  Then after hitting enter it is a bunch of
printouts *but* no GLCanvas::draw appears; at least not until coming back to
the normal size:


GLCanvas::draw width 560 height 420
GLCanvas::draw width 560 height 420
GLCanvas::draw width 560 height 420


OK, so my theory at the moment is that there is a missing


        r.set_viewport (width (), height ());


that needs to be introduced either through calling that   GLCanvas::draw or by
introducing a similar function call in the gl2ps methodology.  When I have
more time, I will look at how gl2ps and on-screen compare.  This bug has
probably always been present, but it may be the case Octave was just lucky in
the sense that the gl2ps context may have reused a block of OpenGL memory that
happened to be the same context for the on-screen renderer and the viewport
was still properly set (note how octave::opengl_renderer r is on the stack so
goes away).  Then, with the new QOpenGLWidget that memory could be partially
overwritten with some bogus number between the two contexts.

Anyway, in summary, find where that viewport is set for the gl2ps OpenGL
context, and if it can't be found, set the viewport.

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?52940>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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