OFFFGL

FFGL, OSC, GLSL. If you like abbreviations, this is the forum for you
Post Reply
sleepytom
Hasn't felt like this about software in a long time
Posts: 236
Joined: Fri Sep 12, 2008 11:11
Location: sussex by the sea

OFFFGL

Post by sleepytom »

I've managed to get the openframeworks / ffgl example plugin to compile :) (very easy even though i'm totally clueless!)

are there any other examples / code snippets which i could look at to learn more about how to code FFGL plugins using openframeworks and xcode?

edwin
Team Resolume
Posts: 1202
Joined: Thu Oct 07, 2004 10:40

Re: OFFFGL

Post by edwin »

You could look around for standard openframeworks examples. Most code will also work in a FFGL plugin. Are you looking for something specific?

sleepytom
Hasn't felt like this about software in a long time
Posts: 236
Joined: Fri Sep 12, 2008 11:11
Location: sussex by the sea

Re: OFFFGL

Post by sleepytom »

I just want to try some really basic things to start with. Simple texture manipulation such as rotation, cropping and mirroring along with simple colour manipulations is what I need to get my head round i think but i'm struggling to find examples of anything so basic!

edwin
Team Resolume
Posts: 1202
Joined: Thu Oct 07, 2004 10:40

Re: OFFFGL

Post by edwin »

Hi Tom,
As you are actually working with OpenGL you could have a look at some basic OpenGL tutorials. Most OpenGL code is just cut and paste-able.
Check out the Nehe site, as this is the best resource for beginning to use OpenGL, it's a bit old but still referenced alot.
http://nehe.gamedev.net/

Below is a code snippet that lets you rotate and scale the input texture.
rotateX, rotateY, rotateZ and scale are all floats defined in the testApp.h file.

Code: Select all

testApp::testApp()
{
	// add parameters
	
	rotateX = 0.5;
	addFloatParameter(	"rotate X",	// name of parameter ( as it will appear in host )
						&rotateX,	// address of the float this parameter will point to
						-180.0f,			// minimum value
						180.0f			// maximum value
					  );
	rotateY = 0.5;
	addFloatParameter("rotate Y",  &rotateY, -180.0f, 180.0f);
	
	rotateZ = 0.5;
	addFloatParameter("rotate Z",  &rotateZ, -180.0f, 180.0f);

	scale = 0.5f;
	addFloatParameter("scale",  &scale, 0, 2.0f);
	
}

//--------------------------------------------------------------
void testApp::setup(){

}

//--------------------------------------------------------------
void testApp::update(){
	ofBackground(100,100,100);
}

//--------------------------------------------------------------
void testApp::draw(){
	// input textures from host are stored here

	ofTexture * tex = inputTextures[0];
	if( !tex )
		return;

	ofSetupScreen();
	ofSetRectMode(OF_RECTMODE_CENTER);

	ofTranslate(tex->getWidth()/2, tex->getHeight()/2, 0.0f);
	ofRotate(rotateX, 1.0, 0.0, 0.0);
	ofRotate(rotateY, 0.0, 1.0, 0.0);
	ofRotate(rotateZ, 0.0, 0.0, 1.0);
	ofScale(scale, scale, 1.0f);
	
	tex->draw(0, 0);
	
}

Joris
Doesn't Know Jack about VJ'ing or Software Development and Mostly Just Gets Coffee for Everyone
Posts: 5185
Joined: Fri May 22, 2009 11:38

Re: OFFFGL

Post by Joris »

The 'Orange Book' is also considered a must have by most OpenGL/GLSL gurus. If only it didn't look so nerdy on your nightstand ;-)

http://www.amazon.co.uk/Opengl-Shading- ... pd_sim_b_4

sleepytom
Hasn't felt like this about software in a long time
Posts: 236
Joined: Fri Sep 12, 2008 11:11
Location: sussex by the sea

Re: OFFFGL

Post by sleepytom »

Thanks this has bee quite helpful so far.

now i have a new issue which i'm finding confusing. I would like to make a plugin which does nothing, just a simple video pass though. but when i do the following i get the video shrunk down 50% and non centrally positioned..

Code: Select all

	
	if( !tex )
		return;
	tex->draw(0, 0);
I've been trying various combos of ofscale and oftranslate but i can't get the damn video centred at the correct size.. :(

Post Reply