# lookup table animation on ms windows

**URL:** <https://psychtoolbox.discourse.group/t/lookup-table-animation-on-ms-windows/1727>\
**Category:** Uncategorized\
**Created:** [November 2, 2006, 1:03am UTC](https://psychtoolbox.discourse.group/t/lookup-table-animation-on-ms-windows/1727 "2006-11-02T01:03:13Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rdbeer](https://avatars.discourse-cdn.com/v4/letter/r/e8c25b/32.png) [@rdbeer](https://psychtoolbox.discourse.group/u/rdbeer)\
**Post date:** [November 2, 2006, 1:03am UTC](https://psychtoolbox.discourse.group/t/lookup-table-animation-on-ms-windows/1727/1 "2006-11-02T01:03:13Z")

</div>

Hello,  
  
much of our code uses lookup table animation. With the older version  
of psychtoolbox, we did that using Screen('SetClut').  
  
I am trying to upgrade our code. My experiments with 'LoadCLUT' and  
'LoadNormalizedGammaTable', as well as the documentation, make it  
clear that these cannot be used for lookup table animation on ms  
windows machines.  
  
What functions should we use?  
  
thanks,  
Dirk B.

---

<div class="post-metadata">

**Author:** ![mariokleiner](https://avatars.discourse-cdn.com/v4/letter/m/13edae/32.png) [@mariokleiner](https://psychtoolbox.discourse.group/u/mariokleiner)\
**Post date:** [November 3, 2006, 12:13am UTC](https://psychtoolbox.discourse.group/t/lookup-table-animation-on-ms-windows/1727/2 "2006-11-03T00:13:46Z")

</div>

None. There is no known workaround for this on M$-Windows at the  
moment and nobody is working on any workaround. You can either try to  
rewrite your code to work without lookup table animation or stick to  
the old Windows PTB 2.54 for now.  
  
-mario  
  

> --- In [psychtoolbox@yahoogroups.com](mailto:psychtoolbox@yahoogroups.com), "rdbeer" \<rdbeer@...\> wrote:  
> \>  
> \> Hello,  
> \>   
> \> much of our code uses lookup table animation. With the older version  
> \> of psychtoolbox, we did that using Screen('SetClut').  
> \>   
> \> I am trying to upgrade our code. My experiments with 'LoadCLUT' and  
> \> 'LoadNormalizedGammaTable', as well as the documentation, make it  
> \> clear that these cannot be used for lookup table animation on ms  
> \> windows machines.  
> \>   
> \> What functions should we use?  
> \>   
> \> thanks,  
> \> Dirk B.  
> \>

---

<div class="post-metadata">

**Author:** ![mariokleiner](https://avatars.discourse-cdn.com/v4/letter/m/13edae/32.png) [@mariokleiner](https://psychtoolbox.discourse.group/u/mariokleiner)\
**Post date:** [November 4, 2006, 6:15am UTC](https://psychtoolbox.discourse.group/t/lookup-table-animation-on-ms-windows/1727/3 "2006-11-04T06:15:44Z")

</div>

There is three answers to this:  
  
a) I don't understand your example. Could you be more specific?  
  
b) With modern gfx-hardware you can create lots of patterns on the fly  
- you are mostly limited by your OpenGL programming skills. E.g., The  
Mandelbrot- or Juliaset- is a pretty non-regular, but still  
deterministic pattern. It can be implemented at an enormous speed on  
the GPU by use of shaders. See e.g.,  
\<[http://developer.3dlabs.com/downloads/glsldemo/](http://developer.3dlabs.com/downloads/glsldemo/)\>  
  
c) One could try to reimplement CLUT animation on recent gfx-cards by  
use of a remap shader. But it wouldn't work on older gfx-hardware and  
it wouldn't work with the old style interface, so people would still  
need to significantly rewrite their code to use it.   
  
-mario  
  

> --- In [psychtoolbox@yahoogroups.com](mailto:psychtoolbox@yahoogroups.com), Keith Schneider \<ks@...\> wrote:  
> \>  
> \> The only stimulus that I have thought of that seems to require CLUT   
> \> animation is a non-regular pattern (say a circular checkerboard)   
> \> whose elements must be rapidly, individually and randomly changed   
> \> colors. The pattern is too large to be generated on-the-fly. I   
> \> suppose you could generate each element individually and store it as   
> \> a texture, and then draw the textures individually in the proper   
> \> locations, but that would end up being a quite large number of   
> \> textures. With CLUT animation you could draw a complex pattern   
> \> containing up to 256 elements and change their colors individually   
> \> and rapidly by changing the CLUT.  
> \>   
> \> Any better ideas for such a stimulus?  
> \>   
> \> keith  
> \>   
> \> On Nov 2, 2006, at 7:13 PM, Mario Kleiner wrote:  
> \>   
> \> \> None. There is no known workaround for this on M$-Windows at the  
> \> \> moment and nobody is working on any workaround. You can either try to  
> \> \> rewrite your code to work without lookup table animation or stick to  
> \> \> the old Windows PTB 2.54 for now.  
> \> \>  
> \> \> -mario  
> \> \>  
> \> \> --- In [psychtoolbox@yahoogroups.com](mailto:psychtoolbox@yahoogroups.com), "rdbeer" \<rdbeer@\> wrote:  
> \> \>\>  
> \> \>\> Hello,  
> \> \>\>  
> \> \>\> much of our code uses lookup table animation. With the older version  
> \> \>\> of psychtoolbox, we did that using Screen('SetClut').  
> \> \>\>  
> \> \>\> I am trying to upgrade our code. My experiments with 'LoadCLUT' and  
> \> \>\> 'LoadNormalizedGammaTable', as well as the documentation, make it  
> \> \>\> clear that these cannot be used for lookup table animation on ms  
> \> \>\> windows machines.  
> \> \>\>  
> \> \>\> What functions should we use?  
> \> \>\>  
> \> \>\> thanks,  
> \> \>\> Dirk B.  
> \> \>\>  
> \> \>  
> \> \>  
> \> \>  
> \> \>  
> \> \> Post your message to: [psychtoolbox@yahoogroups.com](mailto:psychtoolbox@yahoogroups.com)  
> \> \> Please indicate OS9, OSX, or WIN version, and include your full name.  
> \> \> Denis Pelli, David Brainard, and Allen Ingling.  
> \> \> [http://psychtoolbox.org](http://psychtoolbox.org)  
> \> \>  
> \> \> Yahoo! Groups Links  
> \> \>  
> \> \>  
> \> \>  
> \> \>  
> \> \>  
> \>

---

<div class="post-metadata">

**Author:** ![zhujunling\_fmmu](https://avatars.discourse-cdn.com/v4/letter/z/8edcca/32.png) [@zhujunling\_fmmu](https://psychtoolbox.discourse.group/u/zhujunling_fmmu)\
**Post date:** [November 4, 2006, 4:06pm UTC](https://psychtoolbox.discourse.group/t/lookup-table-animation-on-ms-windows/1727/4 "2006-11-04T16:06:53Z")

</div>

Hi Mario,

So many people care about the ‘setclut’ questions. These confuse me.

For visual stimuli in my experiments, I just use grayscale or black&white images, which means I just care about the brightness or luminance of the stimulation. 

I wonder, whether I can simply use the 0-255 to define my brightness or luminance, 0 for black, 255 for white? And I needn’t use the command ‘setclut’? Are brightness or luminance represented by these numbers (0-255) will stable every time when I start my computer?

 &nbsp;

I appreciate you very much if you could give me a reply as soon as possible. 

Thanks.

&nbsp;

Junling Zhu
  
**_Mario Kleiner \<mario.kleiner@...\>_** 写道： 

> > You are "missing" that the old PTB was implemented using M$-DirectX,  
> > whereas the new one is based on OpenGL, and that the new operating  
> > systems are phasing out clut support.  
> >   
> > DirectX has an interface to do clut animation, but you can't use the  
> > DirectX interface to change the clut of OpenGL windows. OpenGL itself  
> > used to have a mode of operation called Index color mode which allows  
> > to do clut animation. However, PTB-3 doesn't implement support for  
> > this mode and it would be lots of work to implement it. OS-X doesn't  
> > support this mode either, but on OS-X you can do clut animation by use  
> > of the gamma tables, same for Linux. Only M$ decided to implement a  
> > few completely brain-dead restrictions into their gamma table  
> > interface. However they seem to support the OpenGL way of clut  
> > animation, but i would have to spend lots of time to implement a  
> > feature that is only supported or needed on M$-Windows, incompatible  
> > to the other OSes implementation and pretty pointless for most  
> > applications anyway because you can do pretty well without cluts on  
> > the new PTB. Also we wouldn't know how well it would work on Windows  
> > and we don't know about the surprises that Windows Vista will bring.  
> >   
> > It is not impossible, not even too difficult (i think) to reimplement  
> > the functionality of cluts on modern graphics hardware by use of pixel  
> > shaders, but the interface would be different from the current one so  
> > you would have to rewrite your code significantly to use it.  
> >   
> > In the end if your code heavily relies on clut animation, there is no  
> > good reason to switch from PTB-2 to PTB-3, because with clut  
> > animation, nearly all of the interesting new features of PTB-3 would  
> > be disabled anyway.  
> >   
> > best,  
> > -mario  
> >   
> > --- In [psychtoolbox@ yahoogroups. com](mailto:psychtoolbox%40yahoogroups.com), "rdbeer" \<rdbeer@...\> wrote:  
> > \>  
> > \> --- In [psychtoolbox@ yahoogroups. com](mailto:psychtoolbox%40yahoogroups.com), "Mario Kleiner"  
> > \> \<mario.kleiner@ \> wrote:  
> > \> \>  
> > \> \> None. There is no known workaround for this on M$-Windows at the  
> > \> \> moment and nobody is working on any workaround. You can either try to  
> > \> \> rewrite your code to work without lookup table animation or stick to  
> > \> \> the old Windows PTB 2.54 for now.  
> > \> Hi Mario,   
> > \> thanks for the reply. I don't understand, though...  
> > \>   
> > \> Screen('SetClut' ) \_did\_ work on ms windows. Maybe there are reasons  
> > \> why it was not ideal, but the fact that it worked means there must be  
> > \> some workaround possible.  
> > \>   
> > \> What am I missing?  
> > \>   
> > \> Regards,  
> > \> Dirk  
> > \> \>   
> > \> \> -mario  
> > \> \>   
> > \> \> --- In [psychtoolbox@ yahoogroups. com](mailto:psychtoolbox%40yahoogroups.com), "rdbeer" \<rdbeer@\> wrote:  
> > \> \> \>  
> > \> \> \> Hello,  
> > \> \> \>   
> > \> \> \> much of our code uses lookup table animation. With the older version  
> > \> \> \> of psychtoolbox, we did that using Screen('SetClut' ).  
> > \> \> \>   
> > \> \> \> I am trying to upgrade our code. My experiments with 'LoadCLUT' and  
> > \> \> \> 'LoadNormalizedGamm aTable', as well as the documentation, make it  
> > \> \> \> clear that these cannot be used for lookup table animation on ms  
> > \> \> \> windows machines.  
> > \> \> \>   
> > \> \> \> What functions should we use?  
> > \> \> \>   
> > \> \> \> thanks,  
> > \> \> \> Dirk B.  
> > \> \> \>  
> > \> \>  
> > \>
> 
>   
> 
> * * *
> [抢注雅虎免费邮箱-3.5G容量，20M附件！](http://cn.mail.yahoo.com)

---

<div class="post-metadata">

**Author:** ![anblick](https://avatars.discourse-cdn.com/v4/letter/a/48db29/32.png) [@anblick](https://psychtoolbox.discourse.group/u/anblick)\
**Post date:** [November 9, 2006, 8:34pm UTC](https://psychtoolbox.discourse.group/t/lookup-table-animation-on-ms-windows/1727/5 "2006-11-09T20:34:21Z")

</div>

If the stimulus were composed of rectangles, it's possible that the   
FillRect command would be fast enough to draw them all....  
  
keith  
  

> On Nov 9, 2006, at 4:02 AM, e\_flister wrote:  
>    
> \> just to make sure i understand -- this point doesn't have to do with  
> \> rectangles or "irregularity," right? just the practical limit of how  
> \> large a texture you can upload in the amount of time you have between  
> \> frames, right?  
> \>  
> \> -erik  
> \>  
> \> --- In [psychtoolbox@yahoogroups.com](mailto:psychtoolbox@yahoogroups.com), Keith Schneider \<ks@...\> wrote:  
> \>\>  
> \>\> It's different because of the image size. If you try to run the  
> \>\> FastNoiseDemo with a rectangle size of 500 or 1000, for example,  
> \>\> there will be a delay and it won't run in real-time.  
> \>\>  
> \>\> keith  
> \>\>  
> \>\> On Nov 8, 2006, at 6:45 AM, e\_flister wrote:  
> \>\>  
> \>\>\>\>\> You can imagine  
> \>\>\>\>\> the checkerboard being irregular in some way (for instance, a  
> \>\>\>\>\> circular bulls-eye pattern) such that you can't draw it using  
> \>\>\>\>\> rectangles.  
> \>\>\>  
> \>\>\>\> Ok, you have a point here.  
> \>\>\>  
> \>\>\> wait, why is this different? i think it is exactly what i was   
> \>\>\> trying  
> \>\>\> to demonstrate with the sample i showed at:  
> \>\>\> [http://www-biology.ucsd.edu/labs/reinagel/eflister/example.mpg](http://www-biology.ucsd.edu/labs/reinagel/eflister/example.mpg)  
> \>\>\> the circular offsets buried in the noise are this kind of  
> \>\>\> irregularity, aren't they?  
> \>\>\>  
> \>\>\> i just checked out FastMaskedNoiseDemo -- sweet, thanks mario --   
> \>\>\> i was  
> \>\>\> totally under the false impression that Screen('MakeTexture') was a  
> \>\>\> no-no in the realtime loop and required Screen('PreloadTextures')!  
> \>\>\> anyway, it seems to me you can make it "irregular" just by operating  
> \>\>\> on the noise matrix prior to turning it into a texture. so in my  
> \>\>\> case, element-wise multiplying by a matrix of variances and then  
> \>\>\> adding a matrix of means -- either or both of these matrices can   
> \>\>\> carry  
> \>\>\> an irregular "signal" to embed in the noise (bulls-eyes, etc).  
> \>\>\> similarly with filtering, etc.  
> \>\>\>  
> \>\>\> i don't get why clut animation is a good idea here at all -- then   
> \>\>\> all  
> \>\>\> the pixels that are the same color on one frame will be the same   
> \>\>\> color  
> \>\>\> (as each other) in all frames, right?  
> \>\>\>  
> \>\>\> -e  
> \>\>\>  
> \>\>\>  
> \>\>\>  
> \>\>\>  
> \>\>\> Post your message to: [psychtoolbox@yahoogroups.com](mailto:psychtoolbox@yahoogroups.com)  
> \>\>\> Please indicate OS9, OSX, or WIN version, and include your full   
> \>\>\> name.  
> \>\>\> Denis Pelli, David Brainard, and Allen Ingling.  
> \>\>\> [http://psychtoolbox.org](http://psychtoolbox.org)  
> \>\>\>  
> \>\>\> Yahoo! Groups Links  
> \>\>\>  
> \>\>\>  
> \>\>\>  
> \>\>\>  
> \>\>\>  
> \>\>  
> \>  
> \>  
> \>  
> \>  
> \>  
> \> Post your message to: [psychtoolbox@yahoogroups.com](mailto:psychtoolbox@yahoogroups.com)  
> \> Please indicate OS9, OSX, or WIN version, and include your full name.  
> \> Denis Pelli, David Brainard, and Allen Ingling.  
> \> [http://psychtoolbox.org](http://psychtoolbox.org)  
> \>  
> \> Yahoo! Groups Links  
> \>  
> \>  
> \>  
> \>  
> \>
