Reply To: Building a Syphon Cinder block application in Eclipse CDT

Home Forums Syphon Syphon Implementations – User Building a Syphon Cinder block application in Eclipse CDT Reply To: Building a Syphon Cinder block application in Eclipse CDT

#4695
eight
Participant

Hi bangnoise!

Thanks a lot, I am almost there. I tried your suggestion to use bindToDrawFrameOfSize and unbindAndPublish, and got my warped and cropped image in the Simple Client…with up to 60 fps (which is the whole point of this exericise!) with a caveat. It seems the Simple Client draws a larger size texture, than I am calculating between the bind.. and unbind..

http://post.scriptum.ru/svalka/syphonClientWarpandcrop.png

Here is a code I am using, I think it should be clear what I am doing:

void dragToSyphon::draw()
{
	glClearColor( 0.0f, 0.0f, 0.0f, 1.0f );
	glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );

	Rectf cropRect = Rectf(0.5f * mTexture.getWidth()+shift, 0.0f * mTexture.getHeight(), 1.0f * mTexture.getWidth()+shift, 1.0f * mTexture.getHeight());

	mScreenSyphon.bindToDrawFrameOfSize(cropRect.getX2() - cropRect.getX1(),cropRect.getY2()-cropRect.getY1());

	gl::setMatricesWindow(getWindowBounds().getWidth(), getWindowBounds().getHeight());

	gl::pushModelView();

	//mTransform is responsible for warping -- calculated using opencv library
        gl::multModelView( mTransform );

	mTexture.enableAndBind();

	Rectf warpRect = Rectf(0, 0, mMovie.getWidth(), mMovie.getHeight());

	//Cropping
	drawTexturedRect( warpRect, cropRect, true );

	gl::popModelView();

	mScreenSyphon.unbindAndPublish();
	mTexture.unbind();

	gl::color( Color( 1, 1, 1 ) );
}

Entire cpp file: http://post.scriptum.ru/svalka/dragToSyphon.cpp

–8