Re: ! Texture out of framebuffer ? !

New Message Reply Date view Thread view Subject view Author view

Ran Yakir (rany++at++amcor.bvr.co.il)
Tue, 9 May 1995 10:06:22 +0000


>
> is it possible to get the contents of the framebuffer to generate a texture
> out of it, like a 'screenshot'? I read the programmer's guide and the manual
> pages, but can't find anything about it? Do I have to use OpenGL for it?
>

Yes. The GL function to do that is fbsubtexload(). It loads a rectangular
region of the framebuffer into a predefined texture. The texture has to be
defined with the TX_FAST_DEFINE property, so it can not have mip-mapping. You
also must define the texture dimensions to be a power of two. The rectangular
region you are loading must have dimensions that divides by 32.
I've never used fbsubtexload() along with Performer, but I think it is rather
straightforward.
The following Performer code fragments will do the job (I hope) :

/*
 * At initialization
 */

screen_tex = pfNewTex (arena);
pfTexFilter (screen_tex, PFTEX_MINFILTER, PFTEX_BILINEAR); /* no mipmap !!! */
pfTexFilter (screen_tex, PFTEX_MAGFILTER, PFTEX_BILINEAR);
pfTexFormat (screen_tex, PFTEX_FAST_DEFINE, PF_ON);
pfTexImage (screen_tex, NULL, 3, xsize, ysize, 1);
...

/*
 * At the post-draw callback
 */

pfApplyTEnv (env);
pfApplyTex (screen_tex);

fbsubtexload (screen_x, screen_y,
                TX_TEXTURE_0, pfGetGLHandle (screen_tex),
                0.0, 1.0, 0.0, 1.0,
                0);

...

This is the simple case in which you fill the whole texture with your screen
image. In other cases, you specify that part of the texture which has to be
filled using the 5th to 8th arguments of the function.

If you need a complete example source, I can compose one for you.

Regards,

Ran

-- 
 __                                  | Ran Yakir
 /_)  _  __   \  / _   / o __        | Graphics App. Chief Engineer
/ )_ (_(_) )   \/ (_(_/<_(_)(        | BVR Technologies Ltd.
              _/                     |   
-------------------------------------+--------------------------------
Phone :                              | E-mail : rany++at++bvr.co.il
  Work : 972-3-5715671               |
  Res. : 972-9-989974                |
Fax    : 972-3-5715668               |

New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:51:29 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.