Loading video on ofxPiMapper (unallocated texture from GL_renderer?)

Hi all,
I’m putting together a projection mapping project and I’m having hard time with my scenes containing video files.

No matter where and how I call the image.allocate, the screen stays black and the “unallocated texture warning” stays persistently in the prompter. Instead of the scene, I get empty screen. :face_with_monocle: I’m bit lost with the concept of texture here. Also, I think I’m getting bit stuck with this and my solutions are getting complicated. If someone can have a quick look at my code and see if there’s something funny going on, that would be a big help!

Also, I’d love to know what is the cleanest way to load videos (or projects containing videos) to ofXPiMapper SceneManager? Is calling fbo, like I do in this code the way to go? Or should I create a separate class for loading videos and getting pixels out of them? As you can hear, a very much beginner here!

Love,
Annina

Video1.h

#include “ofMain.h”
#include “FboSource.h”

class Video1 : public ofx::piMapper::FboSource {
public:
void setup();
void update();
void draw();
void setName(string _name);

    ofVideoPlayer movie;
    ofColor color;
    ofPixels pixels;
    ofImage image;
    int imageWidth, imageHeight;
    int startTime;
    deque <ofImage> imageBuffer;
    int maxBufferSize;
        
    int table[16];

Video1.app

#include “Video1.h”

void Video1::setup(){

name = "Video 1 FBO Source";

allocate(500, 500);
ofSetFrameRate(30);
    
this->beginFbo();
    
imageWidth = 500;
imageWidth = 500;
image.allocate(imageWidth,imageHeight,OF_IMAGE_COLOR);

maxBufferSize = 32;
movie.load("video1_small.mov");
movie.play();
    
for (int i=0; i<16; i++){
    table[i] = ofRandom (0-255);}
this->endFbo();
}

//-------------
void Video1::setName(string _name){
name = _name;
}

//--------------
void Video1::update(){

this->beginFbo();
movie.update();

if (movie.isFrameNew()){
  
    for (int x =0; x<pixels.getWidth(); x++) {
        for (int y =0; y<pixels.getHeight(); y++) {
            
            pixels = movie.getPixels();
            color = pixels.getColor(x, y);

            color.r = table [color.r/16];
            color.g = table [color.g/16];
            color.b = table [color.b/16];

   
            pixels.setColor(x,y,color);}
    }
    image.allocate(500,500, OF_IMAGE_COLOR);
    image.setFromPixels(pixels);
    imageBuffer.push_front(image);
    }

    if (imageBuffer.size()>maxBufferSize) imageBuffer.pop_back();


    this->endFbo();
}

//-----------
void Video1::draw(){
ofSetColor(255, 215, 13);
image.draw(0, 0);
}

Hi,
I think the issue is within the Video1::update(), as you iterate thought pixels.getWidth(), which is never set outside the for loop.
So putting pixels = movie.getPixels(); outside the for loop may give the pixel data.
Then the two for loops will perform the color transformation based upon your table.
Good luck

Edit: I think it’s not necessary to call this->beginFbo() and this->endFbo(), as the example aren’t using it.