[gl2ps] gl2psBegin(End)Viewport usage

Pantxo Diribarne pantxo.diribarne at gmail.com
Sat Apr 18 21:33:49 CEST 2015


Hi,

In GNU Octave we are trying to mimic the effect of "glClear 
(GL_DEPTH_BUFFER_BIT)", which is basically write subsequent primitives 
over previous ones disregarding their z depth,  using 
"gl2psEnd(Begin)Viewport" (see [1]). This works great on some machines 
but fails on others (some win7, see [2]) accompanied with a warning:
"GL2PS warning: Unknown token in buffer"

Here is approximately what we do:
   GLint ret = gl2psBeginPage (... | GL2PS_USE_CURRENT_VIEWPORT ...);
   // draw
   ...
   // A new axes should be drawn over previous objects:
   GLint vp[4];
   gl2psEndViewport ();
   glGetIntegerv(GL_VIEWPORT, vp);
   gl2psBeginViewport (vp);
   ...
   glClear (GL_DEPTH_BUFFER_BIT);
   // draw
   ...
   state = gl2psEndPage ();

Is it the way viewports are supposed to be used in gl2ps, or is there a 
better method to achieve what we want?

Thanks in advance,

Pantxo

[1] https://savannah.gnu.org/bugs/?44806
[2] https://savannah.gnu.org/bugs/?44765