Hello everybody!<br>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).
<br>I use Python, then I used Swig wrapper to use gl2ps.<br>This is my code<br><br><font size="2"><span style="font-family: courier new,monospace;">gldrawable = self.__disegno.get_gl_drawable()</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> glcontext = self.__disegno.get_gl_context()</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> if not
gldrawable.gl_begin(glcontext):</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> return gtk.FALSE</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
glEnable(GL_CULL_FACE)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> glEnable(GL_DEPTH_TEST)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> #glEnable(GL_LINE_SMOOTH) # da usare per la stampa</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> glClear(GL_COLOR_BUFFER_BIT)
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> glColor3f(0.0,0.0,0.0);</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
glMatrixMode(GL_PROJECTION)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> glEnable(GL_LINE_SMOOTH)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> glLoadIdentity()</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> glOrtho(-60.0,60.0,-60.0,60.0,-1000,
1000.0)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> #glFrustum(-50,50,-50,50,-50.0,1000.0)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
#gluPerspective(self.__angolo_prospettiva,1.0,0.1,2000.0)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> gluLookAt(0.0,0.0,10.0, 0.0,0.0,0.0, 0.0
,1.0,0.0)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> miofile = fopen("<a href="http://stampa.ps">stampa.ps</a>","w")</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> fputs("Hello World\n", miofile)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> buffsize = 0
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> self.__disegno.set_viewport(self.__tavola.getLatoMagg()*10.0/0.3528,self.__tavola.getLatoMin()*10.0/0.3528,None,None,in_opengl=True)
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> state=GL2PS_OVERFLOW
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> #glViewport(0,0,900,900)
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> #0.3528 mm</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> #viewport=glGetIntegerv(GL_VIEWPORT)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
view=intArray(1)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
view[0]=0</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> view[1]=0</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
view[2]=int(self.__tavola.getLatoMin()*10.0/0.3528)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> view[3]=int(self.__tavola.getLatoMagg()*10.0/0.3528)
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> for i in range(4):
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> # view[i]=viewport[i]</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
print view[i]</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> while( state == GL2PS_OVERFLOW):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> buffsize= (1024*1024)+buffsize</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> print buffsize
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> gl2psBeginPage("Disco","Stampa",view,GL2PS_PS, GL2PS_NO_SORT,GL2PS_LANDSCAPE,</span>
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> GL_RGBA, 0, None, 0, 0, 0, buffsize,miofile, "<a href="http://stampa.ps">stampa.ps</a>" )
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> gl2psBeginViewport(view)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
gl2psLineWidth(0.5)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> #glRotatef(0,0.0,0.0,1.0)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> self.__disegno.display(True)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> print gl2psEndViewport()
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> state = gl2psEndPage()</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> gldrawable.gl_end()</span></font><br><br>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!
<br><br>Thanks also if you can't answer :-)<br><br>-- <br>Marco Bonifazi