[gl2ps] Tutorial for implementing new backend driver?

Christophe Geuzaine cag32 at case.edu
Thu Nov 10 16:03:58 CET 2005


Micha Bieber wrote:
>> brief guideline how to do this? (Just a few lines like "1. provide
>> function void pgfbackenddriver()... 2. register function
>> pgfbackenddriver() as a new backend driver in function init(), 3. write
>> hooks for gl-feedbacks like this: ...). It will definitely save overall
>> time for developing.
> 
> Look at the bottom part of gl2ps.h. The functions there state the complete public
> interface for gl2ps. They call most of the time another PostScript- resp. PDF version.
> Write the LaTeX variant and use one of the special versions for reference.
> Add suiting mode related #defines.
> That's what I did, when programming the PDF backend.

Just to be a bit more specific: you will have to

1) add "#define GL2PS_XXX 5" in gl2ps.h (where XXX is the name of the 
new output mode)

2) create the following 3 functions in gl2ps.c:

    void gl2psPrintXXXHeader(void)
    void gl2psPrintXXXPrimitive(void *data)
    void gl2psPrintXXXFooter(void)

3) add a "case: GL2PS_XXX" in gl2psBeginPage(), gl2psPrintPrimitives(), 
gl2psEndPage(), gl2psBeginViewport() and gl2psEndViewport().



> BTW, what LaTeX features have you in mind in order to replace the primitive OpenGL
> calls ?
> 


-- 
Christophe Geuzaine
Assistant Professor, Case University, Mathematics
http://www.case.edu/artsci/math/geuzaine