[gl2ps] gl2psBegin(End)Viewport usage

Pantxo Diribarne pantxo.diribarne at gmail.com
Sat Oct 17 19:03:51 CEST 2015


Le 17/10/2015 18:52, Christophe Geuzaine a écrit :
>> On 18 Apr 2015, at 21:33, Pantxo Diribarne <pantxo.diribarne at gmail.com> wrote:
>>
>> 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?
>>
> A priori, yes. I have never personally used them for this purpose, though...
>
> Christophe
>
>> Thanks in advance,
>>
>> Pantxo
>>
>> [1] https://savannah.gnu.org/bugs/?44806
>> [2] https://savannah.gnu.org/bugs/?44765
>>
>>
>> _______________________________________________
>> gl2ps mailing list
>> gl2ps at geuz.org
>> http://www.geuz.org/mailman/listinfo/gl2ps
Actually, we just fixed the issue in Octave: the problem was that I had 
mistakingly assumed the first viewport aws initiated by gl2psBeginPage 
and the last viewport could be ended using gl2psEndPage. Now we do 
BeginPage, BeginViewport ... EndViewport, EndPage and it works.

Thanks,

Pantxo