Quantcast
Channel: beginners - openFrameworks
Viewing all articles
Browse latest Browse all 4929

Video texture asking

$
0
0

@ste wrote:

hello, this is my very first OF try. I am want to achieve a simple video player with keystone like feature( I think ofEasyCam will do the job for me ) and keyboard file changing.

void ofApp::loadVFile( string fName ){
	video.load( fName );
	video.play();
	
	width = video.getWidth(); height = video.getHeight();
	
	while( !video.isLoaded() );
}

//--------------------------------------------------------------
void ofApp::setup()
{
	loadVFile( "1080p2.mp4" );

	ofBackground( 0, 0, 0 );
}

//--------------------------------------------------------------
void ofApp::update(){
	video.update();
}

//--------------------------------------------------------------
void ofApp::draw()
{
	cam.begin();
	video.getTexture().bind();
	/* gives errors, but still works */

	glBegin( GL_QUADS );
	glTexCoord2f(     0,      0 ); glVertex3i(     0,      0, 0 );
	glTexCoord2f( width,      0 ); glVertex3i( width,      0, 0 );
	glTexCoord2f( width, height ); glVertex3i( width, height, 0 );
	glTexCoord2f(     0, height ); glVertex3i(     0, height, 0 );
	glEnd();
	
	video.getTexture().unbind();
	
	cam.end();
}

//--------------------------------------------------------------
void ofApp::keyPressed(int key)
{
	switch ( key ) {
		case 'l':
			loadVFile( "1080p3.mov" );
			break;
			
		case 'r':
			
			break;
	}
}
  1. I am getting few errors after video.getTexture().bind();

[ error ] ofTexture: getTextureData(): texture has not been allocated <<<
but still it seems to work.

  1. I have white screen for few seconds before loading a the file.
  2. Can I change the camera coordinate system centre to the centre of the image instead of bottom left corner?
  3. Can I save the camera position for the next time?

Can anyone advise me?

Running on OSX 10.13.4

Thanks in advance!

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4929

Trending Articles