PDA

View Full Version : printer quality copy



VladimirZh
01-04-2004, 10:53 PM
I have lots of the soft written on FORTRAN and Halo graphics
There is no halo under windows and I try to fing dood substitution of it for windows
I just started to look opengl samples on FORTRAN for few days
I did not find any sample of making printer hard copy ( not print screen quality)
Also I need some sample of so name 'rubber box'
or 'rubber cursor' things, which can be plotted over graphic, moved on it, without
graphics destruction
I can do all this using win32 api, but it is too complicated

mikael_aronsson
01-05-2004, 02:00 AM
Hi !

Have a look in the OpenGL section at www.codeguru.com, (http://www.codeguru.com,) there are examples of printing OpenGL contents.

Mikael

dorbie
01-05-2004, 02:40 AM
OpenGL is a rasterization library. Printing with it generally involves rendering in sections to an offscreen buffer in tiles to bump up the resolution. Because of depth buffering etc it is not easy to do vector based brinting through the lib. But it has been tried:
http://www.geuz.org/gl2ps/

I'm sure there's plenty of code online for this.


OpenGL supports xor blend operations for your rubber band, so it can be done if
EXT_blend_logic_op is a supported extension.

You can also use overlays but that is more complex and not always supported. The most portable way and possible because OpenGL is generally so fast would be to grab the screen and redraw it when you change the box.

The best way (and very portable) is probably just doing a copypixels from back to front instead of a swap and drawing the box to the frontbuffer would probably work very well and be a very fast way of doing things.

if(rubberband){
glReadBuffer(GL_BACK);
glDrawBuffer(GL_FRONT);
glCopyPixels(.......);
glBegin(GL_LINE_LOOP);
// verts
glEnd();
glDrawBuffer(GL_BACK);
}

Just make sure you have your scene in the backbuffer. You could copy it there from the front when you start the rubber band :-)

P.S. if this is buggy in the driver then a gldrawpixels instead of the copy should fare better. But instead of the backbuffer you need to make sure you glreadpixels to your memory array before you start rubber banding. This will involve much more data transfer to and from the graphics card and so will perform slower.

[This message has been edited by dorbie (edited 01-05-2004).]

VladimirZh
01-05-2004, 10:40 PM
Hello Mikael
Thanks for fast answer, unforturnatly
this reference link does not work now.
www.codeguru.com, (http://www.codeguru.com,)

ZbuffeR
01-06-2004, 03:41 AM
Just stick out the ',' http://www.opengl.org/discussion_boards/ubb/smile.gif http://www.codeguru.com