Accessing and Controlling a Movie's alpha

Congratulations on this pre-release

I’ve been playing around with the movie player class, as I understand this uses a texture to place the movie on screen.
now I would like to control the alpha of this movie so that I can stack two movies and mix them…

Do you know how I can access the alpha of the underlying texture?

thanks

massimo

hi massimo,

nice to see you on the board!

the textures in movieplayer take the underlying “draw” color, so if you set the draw color to red, the texture will be tinted red. likewise, if you set the draw color with transparency, the texture will have transparency. the caveat with transparency is that blending is turned off by default, for performance reasons, so you have to turn it on.

you should be able to add transparency like this:

  
  
ofEnableAlphaBlending();         
ofSetColor(255,255,255,127);   // RGBA  
myMovie.draw(0,0,320,240);  
ofDisableAlphaBlending();    
  

this applies transparency across all pixels. If you wanted to have different levels of transparency, for example, chroma-keying, you would have to get the data from the movie player and put into a similar sized array that could contain RGBA info, and then upload that into a ofTexture that is GL_RGBA. There is an example in the texture example of creating an RGBA texture from an RGBA array.

hope that helps -
zach

ps : I have some arduino questions, which I’ll send you a private message about. we are hoping to add serial support for a workshop this weekend…

1 Like

hello zach

the code is working thanks!

I’m happy to get my hands on openframeworks!

Fire away any arduino related questions.

You might be interested in this firmware developed by the great Hans-Christoph Steiner that allows you to control arduino from a serial connection… it’s a tight MIDI-inspired protocol that is already used in PD and Processing.

It’s a good way to get started with Arduino without having to program it manually all the time to, say, read 2 analog ins and blink an LED.

keep up the good work.

massimo