Silverfrost Forums

Welcome to our forums

opengl_printer, opengl_printer

28 Oct 2011 1:13 #9143

i have lines drawn with a %og opengl window. i'd like to print the image displayed, so i have found these functions: opengl_printer@(1,'GL_somebits',iw,ih) opengl_printer@(1,.false.) this sequence of functions prints a all black image... any ideas?

28 Oct 2011 2:10 #9144

I never had any success with opengl_printer@ either.

I use a work around. I convert the OpenGL graphics into a bitmap file. I can then either print the bitmap file using OPEN_PRINTER@ and DIB_PRINT@ or it is simple to create pcx, jpg files or place the graphics in the clipboard.

This is a cut down of my routine to create a bitmap file of the OpenGL display:-

      include <clearwin.ins>,nolist
      include <opengl.ins>,nolist

      CHARACTER*(*) bit_map_file
      CHARACTER*1   ImageData(3*(kw_ogl+3)*kh_ogl),
     *              ImageDib(3,kw_ogl,kh_ogl)

      ImageData=' '
      ImageDib =' '

      call glReadPixels(0,0,kw_ogl,kh_ogl,GL_RGB,
     *GL_UNSIGNED_BYTE,ImageData)

      koff=mod(kw_ogl,4)

      kount=0

        do j=1,kh_ogl

            do i=1,kw_ogl

                do k=1,3
                  kount=kount+1

                  ImageDib(k,i,kh_ogl-j+1)=ImageData(kount)
                end do

            end do

          kount=kount+koff
        end do

      call put_dib_block@(bit_map_file,ImageDib,
     *kw_ogl,kh_ogl,0,0,kw_ogl,kh_ogl,24,ierr)
28 Oct 2011 4:01 #9145

thanks for the answer, but i have a opengl window of 800x600, the image will be 800x600...right? if i want i very high definition image? say 4000x3000?

28 Oct 2011 5:23 #9147

Get a very high definition monitor, or use GDI graphics ?

28 Oct 2011 9:42 #9148

MSDN has a big section on printing OpenGL, and windows extensions, but I can't make head nor tail of it. Just Google OpenGL printing ...

E

30 Oct 2011 11:50 #9156

To achieve a 4000x3000 screen resolution, I define a virtual screen and then use it as the active screen, using: i = create_graphics_region@ (hd_handle, w_width, w_depth) i = select_graphics_object@ (hd_handle) I then dump the virtual screen to a .gif file for later printing.

I recall some testing that there are some practical limits to increasing the size beyond this (5000x3800 might not work), although even moderately higher resolution does look very good.

This is all done in a %gr graphics environment. There may be an equivalent for OPENGL

John

31 Oct 2011 10:55 #9163

A quick google search came up with this:-

http://www.ucancode.net/Visual_C_Control/OpenGL-tutorial-print-preview-vc.htm

which appears to be the OpenGL equivalent for off screen (virtual) rendering. Although getting this up and running in FTN95 is beyond my capability.

Anyone else care to show how it's done?

4 Nov 2011 3:49 #9186

thanks for answers, i'll post results of my trying

Please login to reply.