ofImage conflict with video

Hey all,

I’m trying to display a simple jpg while also playing pre-recorded and live video using ofVideoPlayer and ofVideoGrabber. The moment I try to loadImage in setup(), the live video ceases to work and I get an access violation upon exiting out.

Any ideas what could be going wrong? Any help would be really appreciated.

Thanks,
Logan

My .h file:

  
  
#ifndef _TEST_APP  
#define _TEST_APP  
  
  
#include "ofMain.h"  
  
class testApp : 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);  
		  
		ofVideoGrabber 		vidGrabber;  
  
		ofTexture			videoTexture;  
		int 				camWidth;  
		int 				camHeight;  
		int 				camPosX;  
		int 				camPosY;  
  
		ofVideoPlayer 		starfield;  
		int					screenWidth;  
		int					screenHeight;  
  
		ofImage				testImage;  
  
		bool				videoSnapshot;  
};  
  
#endif	  
  

my .cpp file:

  
  
#include "testApp.h"  
  
  
  
  
  
//--------------------------------------------------------------  
void testApp::setup(){	   
	  
	camWidth 		= 640;	  
	camHeight 		= 480;  
  
	screenWidth 	= 1024;	   
	screenHeight 	= 768;  
  
	camPosX			= screenWidth/2 + camWidth/2;  
	camPosY			= screenHeight/2 - camHeight/2;  
  
	videoSnapshot = false;  
	  
	vidGrabber.listDevices();  
	vidGrabber.setVerbose(true);  
	vidGrabber.initGrabber(camWidth,camHeight);  
  
	starfield.loadMovie("movies/starfield.mp4");  
	starfield.play();  
	starfield.setSpeed(0.75);  
	videoTexture.allocate(camWidth,camHeight, GL_RGB);  
  
	testImage.loadImage("images/bikers.jpg");  
	  
}  
  
  
//--------------------------------------------------------------  
void testApp::update(){  
	  
	ofBackground(0,0,0);  
	  
	  
	starfield.idleMovie();  
	  
	  
	vidGrabber.grabFrame();  
  
	if (vidGrabber.isFrameNew() && !videoSnapshot)  
	{	  
		unsigned char * pixels = vidGrabber.getPixels();  
		videoTexture.loadData(pixels, camWidth,camHeight, GL_RGB);  
	}  
	  
  
  
  
}  
  
//--------------------------------------------------------------  
void testApp::draw(){  
	ofSetColor(0xffffff);  
  
	starfield.draw(0,0,screenWidth,screenHeight);  
	videoTexture.draw(camPosX,camPosY,-camWidth,camHeight);  
}  
  
  
//--------------------------------------------------------------  
void testApp::keyPressed  (int key){   
	  
	if (key == 's' || key == 'S'){  
		vidGrabber.videoSettings();  
	}  
	  
	if (key == ' ')  
	{  
		if(!videoSnapshot) videoSnapshot = true;  
	}  
	  
}  
  
  
//--------------------------------------------------------------  
void testApp::keyReleased(int key){   
	  
}  
  
//--------------------------------------------------------------  
void testApp::mouseMoved(int x, int y ){  
	  
}  
  
//--------------------------------------------------------------  
void testApp::mouseDragged(int x, int y, int button){  
	  
}  
  
//--------------------------------------------------------------  
void testApp::mousePressed(int x, int y, int button){  
	  
}  
  
//--------------------------------------------------------------  
void testApp::mouseReleased(int x, int y, int button){  
  
}  
  
//--------------------------------------------------------------  
void testApp::windowResized(int w, int h){  
  
}  
  

Could you zip up that project and post it by any chance? I ran your code with a video, image, and live feed and didn’t run into any problems, there’s nothing in there that looks at all unusual, maybe the image or video is corrupt somehow?

I can actually run the code just fine using the mac version - i only have issues using Windows (XP on a Macbook Pro). Could it be a bug?

-Logan