[gl2ps] Problem with linewidth and viewport
Christophe Geuzaine
cgeuzaine at ulg.ac.be
Tue Aug 21 13:20:44 CEST 2007
Michael Goffioul wrote:
> Hi,
>
> I'm trying to use GL2PS in my project, but faced a problem with linewidth
> restoration after a gl2psEndViewport. All my lines are 0.5 wide and I issue
> glLineWidth(0.5) as well as gl2psLineWidth(0.5). This works fine for the first
> viewport. After gl2psEndViewport call, I see the "grestore" code in
> the generated
> PS, which somehow reset the line width to 1.0. However, the OpenGL as well
> as GL2PS state is not changed: they both cache the previous 0.5 value, such
> that no further linewidth settings is produced in the PS code.
>
Hi Michael - Indeed, we cache the last used color, line width, ...,
across viewports... but we probably shouldn't.
Can you replace the "gl2psEndViewport" routine with this one and let me
know if it fixes the problem?
GL2PSDLL_API GLint gl2psEndViewport(void)
{
GLint res;
if(!gl2ps) return GL2PS_UNINITIALIZED;
res = (gl2psbackends[gl2ps->format]->endViewport)();
/* reset last used line width */
gl2ps->lastlinewidth = -1.0F;
return res;
}
If it does I'll make sure to fix the bug in the next release.
Thanks for the feedback,
Christophe
> This happens with gl2ps-1.3.2.
>
> Is there a way to workaround that?
> Thanks.
>
> Michael.
>
> _______________________________________________
> gl2ps mailing list
> gl2ps at geuz.org
> http://www.geuz.org/mailman/listinfo/gl2ps
>
>
--
Prof. Christophe Geuzaine
University of Liege, Electrical Engineering and Computer Science
http://www.montefiore.ulg.ac.be/~geuzaine