Re: openGL problem
From: Richard Harke (rharke_at_earthlink.net)
Date: Mon, 27 Jun 2005 19:26:15 GMT
Dances With Crows wrote:
> On Mon, 27 Jun 2005 05:39:24 GMT, Richard Harke staggered into the Black
> Sun and said:
>> Dances With Crows wrote:
>>> On Sat, 25 Jun 2005 20:54:14 GMT, Richard Harke staggered into the
>>> Black Sun and said:
>>>> I am trying to draw a hyperbola. I have very simple code to draw the
>>>> three axes and that displays. if I add a call to sinh and cosh to
>>>> calculate a point on the hyperbola, I get nothing, not even my
>>>> coordinate axes.
>>> You may wish to fprintf() the values you're getting from sinh()
>>> and/or cosh() to stderr, just to make sure the functions aren't
>>> returning "domain error" or "range error" or NaN or something that
>>>> Either way, calls to sinh and cosh are in the display callback
>>> If this is 3D, you need to make sure the shape you're drawing isn't
>>> between the camera and the light source. Try restricting the X..Y
>>> range from -1..1 and moving the camera to 1.5,1.5,1.5 look_at 0,0,0.
>> I know my image is in the right place wrt the camera because with the
>> calls to sinh and cosh it is fine.
typo; should have been without
> Huh? You said in your original message that it *wasn't* fine. Or did
> you mean "without"? (Saying "can" for "can't" is a Kentucky or
> Tennessee speech marker--is with/without a new speech marker?)
Its a marker for brain fade
>> I can substitute an expression using calls to exp and get the image I
>> want. But it also appears that the problem has nothing to do with
>> openGL but something is badly wrong with sinh and cosh.
> sinh and cosh are implemented in terms of exp according to the man pages
> for sinh and cosh. cosh(x) is (exp(x) + exp(-x)) / 2 , f'rexample.
> Unless your libm is totally whacked, of course. What's the output of
> "ls -l /lib/libm*" ?
>> I have tried a little test program with no openGL, just printf.
>> The expression with exp is fine but sinh and cosh give crap.
>> I guess I need a more appropriate forum to follow up.
> Maybe the libm people? I don't know off the top of my head who
> maintains libm. I'm using libm 2.3.2 here, but if I do something like:
> printf("d=%f , cosh=%f , exp=%f\n",d,
> cosh(d),((exp(d) + exp(-d)) / 2));
> ...I get the exact same numbers for cosh= and exp=. They may not be the
> *right* numbers (it's been a while since I had to use hyperbolic
> cosines), but they're exactly the same.
I was not getting the same values for those two cases. And when the
calls to sinh and cosh were in the same executable, most of the
values for (exp(x) + exp(-x))/2 were corrupted => NAN
libm is part of libc6
for ls -l /lib/libm*
/lib/libm.so.6 -> libm-2.3.2.so
I re-installed libc6 using the libc6-i686 version
(apt-get install libc6-i686)
The sinh and cosh values are still crap but it no longer
corrupts the values computed from exp
Spoke too soon -- recompiled my test program and it now
gives identical values for both.