[vtk-developers] [ARB?] Plans for the vtkGL2PSExporter class.

Prabhu Ramachandran prabhu at aero.iitm.ernet.in
Sat May 31 14:14:20 EDT 2003


>>>>> "SB" == Sebastien BARRE <sebastien.barre at kitware.com> writes:

    SB> Hi At 5/31/2003 01:38 PM, Prabhu Ramachandran wrote:

    >> 3. The class does not yet support text properly.  This will
    >> require modifications to vtkTextActor.

    SB> Why ?

Umm, TextMapper is more correct but I am not quite sure about all this
since I havent lookead at this hard enough (and its been a while).

The trouble is that gl2ps does not output text with VTK.  Perhaps its
due to ftgl.  I don't know and will need to experiment a little.  I
would have been a lot clearer a few months ago when I wrote the class
(and had a few more ideas) but not now.  Hopefully I'll make more
sense in time. :)

    >> This could be somewhat involved.  I dont have any code for this
    >> yet but I believe Goodwin has a working implementation.  My
    >> plan is to first look at Goodwin's code and see how he does it.
    >> What I'd like to eventually do is possibly toggle a global flag
    >> in the TextActor so that when gl2ps is generating output all
    >> TextActors will call gl2psText with the appropriate
    >> information.  I dont know if this is workable or not.

    SB> I do not know if it's the right approach to add an ivar to
    SB> vtkTextActor that is so specific to that exporter, but I have
    SB> the feeling here you mean mapper instead of actor, don't you ?
    SB> The text mappers is where the real rendering code is (now
    SB> unified in vtkOpenGLFreetypeTextMapper), and I'm not even sure

Yes.  I meant mapper.  I remember looking at the Mapper code last
december to see how this could be accomplished.

    SB> you want to go that deep since this mapper propagates calls to
    SB> the ftgl library, which issues glPixmap/glBitmap calls using
    SB> the pixmap/bitmap rendered by the freetype lib from a set of
    SB> vectorized fonts embeded in VTK. In any case, the text that is
    SB> rendered on the screen is image-based as soon as it goes out
    SB> of freetype, so I'm not sure it will be of any help for a
    SB> Postscript exporter since you might end up with something very
    SB> blocky (unless you render at the printer resolution, but you
    SB> will have to work that out).

No, what i need is to know the current rendering location, the text to
be output, its font and size.  With that known gl2ps can generate the
necessary text.  The nice thing is that this text can also be dumped
to a TeX file, thereby enabling nice math.  From the gl2ps docs:

   void gl2psText( const char *string, const char *fontname,
                   GLint  fontsize )

  gl2psText permits to include text in the PostScript or LaTeX output
  in a very simple way. The text is inserted at the current raster
  position (set by one of the glRasterPos OpenGL commands). Beware
  that text will be sorted according to the position of the leftmost
  element of the string only.

So my thought was to somehow ask the TextMapper to make this call when
gl2ps was doing its thing.

If you know of an alternative (trivial or less intrusive) way to
accomplish this please do let us know!

Thanks.
prabhu



More information about the vtk-developers mailing list