[gl2ps] Viewport limix size problem

Marco Bonifazi marcobonifazi at gmail.com
Thu Jan 12 09:36:51 CET 2006


Hello everybody!
I have a problem with OpenGl viewport: when I convert my viewport to print
into postscript, changing from monitor sizes into printing size. I tried to
use A0 format (then I use 1 pixel=0.3527777778 mm conversion).
I use Python, then I used Swig wrapper to use gl2ps.
This is my code

gldrawable = self.__disegno.get_gl_drawable()
        glcontext  = self.__disegno.get_gl_context()
        if not gldrawable.gl_begin(glcontext):
            return gtk.FALSE
        glEnable(GL_CULL_FACE)
        glEnable(GL_DEPTH_TEST)
        #glEnable(GL_LINE_SMOOTH) # da usare per la stampa
        glClear(GL_COLOR_BUFFER_BIT)
        glColor3f(0.0,0.0,0.0);
        glMatrixMode(GL_PROJECTION)
        glEnable(GL_LINE_SMOOTH)
        glLoadIdentity()
        glOrtho(-60.0,60.0,-60.0,60.0,-1000,1000.0)
            #glFrustum(-50,50,-50,50,-50.0,1000.0)
            #gluPerspective(self.__angolo_prospettiva,1.0,0.1,2000.0)
        gluLookAt(0.0,0.0,10.0, 0.0,0.0,0.0, 0.0,1.0,0.0)
        miofile = fopen("stampa.ps","w")
        fputs("Hello World\n", miofile)
        buffsize = 0
        self.__disegno.set_viewport(self.__tavola.getLatoMagg()*10.0
/0.3528,self.__tavola.getLatoMin()*10.0/0.3528,None,None,in_opengl=True)

        state=GL2PS_OVERFLOW

        #glViewport(0,0,900,900)
        #0.3528 mm

        #viewport=glGetIntegerv(GL_VIEWPORT)
        view=intArray(1)

        view[0]=0
        view[1]=0
        view[2]=int(self.__tavola.getLatoMin()*10.0/0.3528)
        view[3]=int(self.__tavola.getLatoMagg()*10.0/0.3528)

        for i in range(4):
           # view[i]=viewport[i]
            print view[i]
        while( state == GL2PS_OVERFLOW):
            buffsize= (1024*1024)+buffsize
            print buffsize
            gl2psBeginPage("Disco","Stampa",view,GL2PS_PS,
GL2PS_NO_SORT,GL2PS_LANDSCAPE,
                              GL_RGBA, 0, None, 0, 0, 0, buffsize,miofile, "
stampa.ps" )
            gl2psBeginViewport(view)
            gl2psLineWidth(0.5)
            #glRotatef(0,0.0,0.0,1.0)
            self.__disegno.display(True)
            print gl2psEndViewport()
            state = gl2psEndPage()

        gldrawable.gl_end()

The focus oh the problem is that my printing viewport is always 2048x2048 (I
can see it when I open my ps file), which is the opengl limit to print on
the screen, but I must print to the plotter, I think I need more viewport!

Thanks also if you can't answer :-)

--
Marco Bonifazi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.geuz.org/pipermail/gl2ps/attachments/20060112/07f471e4/attachment.html>