Re: [info-performer] scrolling textures

New Message Reply Date view Thread view Subject view Author view

From: Yair Kurzion (yair++at++polygon.engr.sgi.com)
Date: 06/10/2002 14:08:52


Hi Brad !

Messing with any OpenGL state that Performer already manages is not healthy.
The best way to change the texture matrix is through pfGeoState
(PFSTATE_ENTEXMAT and PFSTATE_TEXMAT, see pfGeoState man page).

You may be able to access OpenGL directly by adding the following line to your
pre-DRAW callback:

    pfOverride(PFSTATE_ENTEXMAT | PFSTATE_TEXMAT, PF_ON);

and adding the following line to your post-DRAW callback:

    pfOverride(PFSTATE_ENTEXMAT | PFSTATE_TEXMAT, PF_OFF);

In general, if your application is graphics-limited (as opposed to host CPU
limited), you should consider using fluxed texture coordinates for your
rain/show geometry. This way, you compute the texture final coordinates for
each geoset every frame on the host instead of making the graphic hardware
compute it for you.

Sample code for fluxed coordinates:

    /usr/share/Performer/src/pguide/libpf/C++/flux_color.C
    /usr/share/Performer/src/pguide/libpf/C/multiTexBox_flux.c

-yair

> This is my idea which I'm not succeding to implement:
> I'm trying to create rain/snow effect in a driving
> simulation by having billboards, texture mapped with
> rain or snow, around the camera view. To create the
> effect of the rain coming down I wanted to scroll the
> texture-maps down, using a draw cullback. This would
> be a lot more efficent than using DCS's for each
> rain/snow plane.
> using openGL it can be accomplished by:
>
> int pfdPreDrawRain(pfTraverser *a, void *d){
> glMatrixMode(GL_TEXTURE);
> glLoadIdentity();
> glRotatef(x,1,0,0);
> x += 0.1;
> return PFTRAV_CONT;
> }
>
> This doesn't work with performer, how do I go about
> doing this? Flux's? Can anyone point me in some
> direction or have some example code?
> Thanks!
> -brad
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! - Official partner of 2002 FIFA World Cup
> http://fifaworldcup.yahoo.com
>

-- 
\_________  \_____  \__    \__  \_____        
\_________  \_____   \__   \__  \_____         Yair Kurzion
       \__     \__   \____\__      \__         yair++at++sgi.com
       \__          \__  \__                  (650) 933-6502
       \__          \__   \__          
       \__          \__    \__             


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Thu Jun 13 2002 - 05:22:08 PDT

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