ofxPlaymodes problems and errors

I am trying to work with ofxPlaymodes right now. I have the examples running, one that has a lot of what I’m trying to figure out is the feedback example. I have things copied over to my project and I’m working on making sense of the different objects and classes. My program is crashing after a few seconds though, resulting in this

Here is what is in my .cpp:

    #include "ofApp.h"
using namespace ofxPm;

//--------------------------------------------------------------
void ofApp::setup(){
    
            //ofSetBackgroundAuto(FALSE);//to prevent automatic background clearing
    ofSetVerticalSync(TRUE);
    ofEnableAlphaBlending();
    
    //OFXPLAYMODES
        grabber.setDesiredFrameRate(30);
        grabber.setFps(30);
        grabber.initGrabber(ofGetWidth(),ofGetHeight());
        vHeader.setup(vBuffer);
        vMixer.setup(grabber,vHeader);
        vRate.setup(vMixer,30);
        vBuffer.setup(vRate,400,false);
        vHeader.setDelayMs(1000);
        
        vRenderer1.setup(vMixer);
        //vRenderer2.setup(vMixer);//refers to the affected video

    ofBackground(0);
    
    //UDP
    udpConnection.Create();
    udpConnection.Bind(7406);
    udpConnection.SetNonBlocking(TRUE);
}

//--------------------------------------------------------------
void ofApp::update(){
    grabber.update();//is this redundant?
	//vHeader.setDelayMs(1000);//tells header to delay playback
    
    
    //UDP
    char udpMessage[100];
    udpConnection.Receive(udpMessage,100);
    message = udpMessage;
}

//--------------------------------------------------------------
void ofApp::draw(){
    
    vBuffer.draw();
	vHeader.draw();
    vRenderer1.draw();
    grabber.draw(0,0);
    
    ofSetColor(255,255,255);
    
    if(message == "bang"){
        if(blurActive == TRUE){
            blurActive = FALSE;
        }else{
            blurActive = TRUE;
        }
    }
}

//--------------------------------------------------------------
void ofApp::keyPressed(int key){
    
    //Blur
    if(key == 'b'){//b up
        blur += 1;
        if(blur > 255){
            blur = 255;
        }
    }
    if(key == 32){//spacebar down
        blur -= 1;
        if(blur < 1){
            blur = 0;
        }
    }
    
    if(key == 't'){//t to toggle blur (or snap while max patch is running)
        if(blurActive == TRUE){
            blurActive = FALSE;
        }else{
            blurActive = TRUE;
        }
    }
}

//--------------------------------------------------------------
void ofApp::keyReleased(int key){
    
}

//--------------------------------------------------------------
void ofApp::mouseMoved(int x, int y ){
    
}

//--------------------------------------------------------------
void ofApp::mouseDragged(int x, int y, int button){
    
}

//--------------------------------------------------------------
void ofApp::mousePressed(int x, int y, int button){
    
}

//--------------------------------------------------------------
void ofApp::mouseReleased(int x, int y, int button){
    
}

//--------------------------------------------------------------
void ofApp::windowResized(int w, int h){
    
}

//--------------------------------------------------------------
void ofApp::gotMessage(ofMessage msg){
    
}

//--------------------------------------------------------------
void ofApp::dragEvent(ofDragInfo dragInfo){
    
}

and my .h:

    #pragma once

#include "ofMain.h"
#include "VideoBuffer.h"
#include "VideoHeader.h"
#include "VideoGrabber.h"
#include "VideoRenderer.h"
#include "VideoRate.h"
#include "VideoMixerGPU.h"
#include "BasicVideoRenderer.h"
#include "ofxNetwork.h"

class ofApp : public ofBaseApp{
    
public:
    void setup();
    void update();
    void draw();
    
    void keyPressed(int key);
    void keyReleased(int key);
    void mouseMoved(int x, int y );
    void mouseDragged(int x, int y, int button);
    void mousePressed(int x, int y, int button);
    void mouseReleased(int x, int y, int button);
    void windowResized(int w, int h);
    void dragEvent(ofDragInfo dragInfo);
    void gotMessage(ofMessage msg);
    
    ofxUDPManager udpConnection;
    
    //OFXPLAYMODES
    ofxPm::VideoGrabber grabber;
    ofxPm::VideoBuffer vBuffer;
    ofxPm::VideoHeader vHeader;
    ofxPm::BasicVideoRenderer vRenderer1;
    ofxPm::VideoRate vRate;
    ofxPm::VideoMixerGPU vMixer;
    
    int blur = 100;
    bool blurActive = TRUE;//defaults to blur
    
    string message = "default";
    
};

Any tips on how to get things running properly?

Thanks

Ok, so it looks like my error is happening in grabber.initGrabber(ofGetWidth(),ofGetHeight());. That’s what is returning a bad_alloc error.

HI @Ace change the grabber settings to 640x480 and it should work again. Otherwise I think you are feeding a texture to playModes bigger than it has allocated memory for. Let me know if that solves your problem.

Is there any way to get 1080x720?

it sounds like your camera isn’t capable of that resolution

Sorry just had a look at the PlayModes code. The video Frame size internally used by PlayModes is set based on the size passed into the initGrabber function so playmodes does and will (just tried) work with various resolutions such as 1080x720.

Can you try just the basic VideoGrabberExample in the examples/video/ folder to see if you are able to set the cam to capture at that resolution. If not then jvcleave is probably right.

Hmm… I can get the normal ofVideoGrabber to use that resolution… Looking at Playmodes I was thinking that too, that it should be using the size passed in. The cam displays for a little while anyways before I get the error, about 10 seconds.