[gl2ps] Clipping and Background
Christophe Geuzaine
geuzaine at acm.caltech.edu
Tue Mar 22 19:10:42 CET 2005
Joe Miller wrote:
> Hi,
>
> I had a quick question about clipping and backgrounds
> with postscript. I see in the example provided how to
> start and end the gl2psViewport so that gl2ps clips at
> the boundaries. However, before you issue the clip
> command you do a fill which clears the background. I
> was wondering if there was a particular reason for
> this or if there was another way I could clip in
> postscript.
>
> Here's my situation. I setup a viewport in opengl, I
> then open up another viewport on top of the original
> one. I then add some text to the top viewport and some
> of that text falls out of that viewport's range
> (though is clipped by the rasterizer). The text that
> falls out of range is not being completely clipped in
> postscript when I don't set gl2psViewportBegin/End.
> When I set gl2psViewport it clips the text correctly,
> however, the picture on the bottom viewport is cleared
> by the fill.
>
> So I was wondering if you had any suggestions (besides
> switching to one viewport) or if it was going to be
> problematic for me if I removed the fill line.
>
Hi Joe - Indeed, for PS/EPS output, the current version of GL2PS does
not clip the viewport if the background is not drawn (that's a bug!). In
addition, the current version provides no way to disable the background
for just a specific viewport (that's a shortcoming in the API).
I tried to fix both issues in my CVS tree:
- gl2psBeginViewport() now always clips (even if GL2PS_DRAW_BACKGROUND
is not set)
- there is a new function in the API called gl2psSetOptions() that
permits to change the options on the fly. You could for example call
gl2psBeginPage() with options=GL2PS_DRAW_BACKGROUND, and then change the
options before calling gl2psBeginViewport() in order to disable the
background drawing for that specific viewport.
The new version is available here:
http://geuz.org/gl2ps/src/gl2ps-nightly.tgz
Let me know if this solves your problem.
Take care,
Christophe
> Sorry for being so long winded. Thanks for the help.
>
> -joe
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
> _______________________________________________
> gl2ps mailing list
> gl2ps at geuz.org
> http://www.geuz.org/mailman/listinfo/gl2ps
>
--
Christophe Geuzaine
Applied and Computational Mathematics, Caltech
geuzaine at acm.caltech.edu - http://geuz.org