replace pixels of QT with small QTs and set position

hi, I’m a very beginner.
I’m trying to do something very similar to the videoPlayer example, where the size of the dot is controlled by the value of red pixel. Instead of dots I would like to draw small qt movies and instead of the size I would like to control the position of the playback head.
Right now all my qt movies are in sync, playing the same frame at the same time, and the frame appears to be pretty random. could you please help me figure out what I’m doing wrong?

  
unsigned char * pixels = fingerMovie.getPixels();  
	for (int i = 5; i < 320; i+=10){  
		for (int j = 5; j < 240; j+=10){  
			unsigned char r = pixels[(j * 320 + i)*3];  
			float val = 1 - ((float)r / 255.0f);  
			ofSetColor(0x000000);  
			ofCircle(400 + i,20+j,10*val);  
			ofSetColor(0xFFFFFF);  
			circleMovie.setPosition((float)val*100);  
			circleMovie.draw(100 + i*3,280+j*2.3);  
  
		}  

hi !

nice to have you with us -

in the code, this looks wrong:

  
  
circleMovie.setPosition((float)val*100)   
  

since setPosition take a pct 0-1, not a value between 0-100

also, you might try pausing the small movies you are manipulating –

does that help?

take care!!
zach

thanks for such a fast response!
I replaced that line so the value is not between 0.0 - 1.0:

  
unsigned char * pixels = fingerMovie.getPixels();  
	for (int i = 5; i < 320; i+=10){  
		for (int j = 5; j < 240; j+=10){  
			unsigned char r = pixels[(j * 320 + i)*3];  
			float val = ((float)r / 255.0f);  
			ofSetColor(0xFFFFFF);  
			circleMovie.setPosition(val);  
			circleMovie.draw(100 + i*3,280+j*2.3);  
  
		}  

Pausing seemed to help – the quicktimes do seem to respond to changes in the large movie, but they’re still all in sync, playing the same frame…

I think the problem is that you can’t just update the movie and then draw it – you have to give quicktime some time work. I think it might be better to do something more advanced, like load in an array of images (then you can easily move between them) or load the quicktime into textures (as others on the forum have done, like here)

can you try this (it might be ***painfully*** slow depending on the number of draw calls):

circleMovie.setPosition((float)val);
circleMovie.idleMovie();
circleMovie.draw();

I don’t have high hopes for this (right now you are drawing 32*24 movies), but it might help – a much faster option will be to load in an array of images or the texture thing…

take care!
zach

I will look into loading the quickitme into textures and using sequences of images (they’re under 1 second long).
thanks!
karolina