Re: Toggle textures on/off

New Message Reply Date view Thread view Subject view Author view

From: Benedikt Kessler (bjk++at++munich.sgi.com)
Date: 02/13/2002 08:05:13


Hi!

The enable part is wrong; ypu must call pfOverride(..., 0) to allow
state changes
and you call pfOverride(..., 1) to freeze the states; so yor code must
be:

else {
        TexMode = TRUE;
        cout << "enable texture" << endl;
        pfOverride(PFSTATE_ENTEXTURE | PFSTATE_TEXTURE | PFSTATE_ENTEXGEN, 0);
// not 1
        pfEnable(PFEN_TEXTURE);
        pfEnable(PFEN_TEXGEN);
        pfOverride(PFSTATE_ENTEXTURE | PFSTATE_TEXTURE | PFSTATE_ENTEXGEN, 1);
// not 0
}

Jürgen Gotschlich wrote:
>
> High,
>
> I would like to enable?disable all textures in my application. How to do
> this ?
> First I simply tried
>
> if( pfGetEnable(PFEN_TEXTURE)) pfDisable( PFEN_TEXTURE );
> else pfEnable( PFEN_TEXTURE );
>
> But since this didn't work properly, I tried the following. The
> 'disable'-case is copied out of perfly and is working well. But the
> 'enable'-case (written by my own) is wrong. The textures are enabled,
> but in wireframe. Why that ?
>
> if( TexMode ) {
> TexMode = FALSE;
> cout << "disable texture" << endl;
> pfOverride(PFSTATE_ENTEXTURE | PFSTATE_TEXTURE | PFSTATE_ENTEXGEN,
> 0);
> pfDisable(PFEN_TEXTURE);
> pfDisable(PFEN_TEXGEN);
> pfOverride(PFSTATE_ENTEXTURE | PFSTATE_TEXTURE | PFSTATE_ENTEXGEN,
> 1);
> }
> else {
> TexMode = TRUE;
> cout << "enable texture" << endl;
> pfOverride(PFSTATE_ENTEXTURE | PFSTATE_TEXTURE | PFSTATE_ENTEXGEN,
> 1);
> pfEnable(PFEN_TEXTURE);
> pfEnable(PFEN_TEXGEN);
> pfOverride(PFSTATE_ENTEXTURE | PFSTATE_TEXTURE | PFSTATE_ENTEXGEN,
> 0);
> }
>
> Some ideas ?

-- 
+---------------------------------+----------------------------------+
|Benedikt J. Kessler              | Silicon Graphics GmbH            |
|Professional Services            | Am Hochacker 3 - Technopark      |
|SGI                              | 85630 Grasbrunn-Neukeferloh, FRG |
|    ---  __o       ,__o          |                                  |
| ------_ \<,_    _-\_<,          | Phone: (+49) 89 46108-366 or -0  |
|----- (*)/ (*)  (*)/'(*)         | Fax:   (+49) 89 46107-366        |
+---------------------------------+----------------------------------+
|E-Mail: bjk++at++sgi.com    Web (private): http://reality.exsgi.org/bjk  |
|   Web: http://www.sgi.de                                           |
+--------------------------------------------------------------------+


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Wed Feb 13 2002 - 08:05:50 PST

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