Re: [UFO-devel] Patch: ufo::UGL_Graphics::mapToDevice()
Status: Beta
Brought to you by:
schmidtjf
|
From: Andreas B. <b_...@gm...> - 2006-03-31 01:44:21
|
On Thursday 30 March 2006 23:04, Johannes Schmidt wrote:
> On Saturday 25 March 2006 16:53, Johannes Schmidt wrote:
> > On Friday 10 March 2006 21:44, Andreas Beckermann wrote:
> > > Hi
> > > attached a patch that fixes ufo::UGL_Graphics::mapToDevice():
> > > the last coordinate inside a rect is (rect.y + rect.h - 1), not (rect.y
> > > + rect.h).
> >
> > Thanks, applied to CVS.
>
> Err, the statement above is right, but in that case it is reverted, e.g. in
> mapToDevice:
Indeed. I guess I have worked a little too much with the code and got confused
by my own equations in the end :-(
Okok, so back to the start. The error is not here, but there definitely is
one, as you can see if you draw a (not filled) rect in a paintWidget() method
with vertices (0,0), (0,h-1), (w-1,h-1), (w-1, 0). Not all lines are shown.
-> this can be easily traced back to the clipping rect.
Well, it took me quite some time to find another possible error source for
this problem (in fact it already took quite some time to find why the patch
was necessary for me..), but I think I found it:
in resetDeviceViewMatrix():
ugl_driver->glOrtho(
0,
contextBounds.w,
contextBounds.h,
0,
-100,
100
);
glOrtho() docs say it takes left, right, bottom, top parameters. However you
give it left, right+1, bottom+1, top, as contextBounds.w is already outside
of the context bounds.
So the correct fix should be to replace the above call to
ugl_driver->glOrtho(
0,
contextBounds.w - 1,
contextBounds.h - 1,
0,
-100,
100
);
Ok, so hopefully I am not already too tired this time :-)
CU
Andi
|