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

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

[Octave-bug-tracker] [bug #58956] Empty plot for certain xlim / ylim set


From: Hg200
Subject: [Octave-bug-tracker] [bug #58956] Empty plot for certain xlim / ylim settings
Date: Mon, 7 Sep 2020 02:33:06 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0

Follow-up Comment #10, bug #58956 (project octave):

Attached is a demo code that is independent of Octave and that demonstrates
the same behavior in Qt. The code places a unit cube (length = 1) between
"nearVal" and "farVal" and sets "nearVal" and "farVal" in glOrtho() to a large
value, while the difference "farVal - nearVal" is chosen to be small in
comparison to the object-camera distance. The adjustment can be done in
"mainwindow.h":

++
double nearVal = 1e+6 - 2.0;
double farVal = 1e+6 + 2.0;
--

If the values are selected as

++
double nearVal = 1e+11 - 2.0;
double farVal = 1e+11 + 2.0;
--

the cube is not displayed, which is consistent with the observation made in
Octave.

The two relevant commands are:

++
glOrtho(-aspectratio, aspectratio, -1, 1, nearVal, farVal);
--

++
glTranslated(0.0, 0.0, -(farVal - 2.0));
--

The cube is displayed when the difference "farVal-nearVal" becomes larger. For
example, if nearVal is set to zero or set to a negative value (moving the
clipping plane behind the camera is explicitly allowed for glOrtho). And / or
farVal is selected as a factor greater than 1.0 of the object-camera distance.
This observation is also consistent with what i observe in Octave. 

Adding / subtracting a small value to a large value in floating point
arithmetic is dangerous, but 1e+11+2.0 should be fine. In any case, we might
also want to draw axes with 1e+22 rather than 1e+11, and then the problem
becomes more obvious.

What is really happening in Octave depends now on the modelview- and
projection matrix calculated in graphics.cc (update_camera). But according to
GDB it looks like the "farVal-nearVal" difference is not proportional to the
distance between the object and the camera. If no one can provide information
about it, I will dig more into graphics.cc now.


(file #49750)
    _______________________________________________________

Additional Item Attachment:

File name: opengl_test.tar                Size:10 KB
    <https://file.savannah.gnu.org/file/opengl_test.tar?file_id=49750>



    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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