Page 1 of 1
OFFFGL
Posted: Thu Apr 15, 2010 13:06
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?
Re: OFFFGL
Posted: Thu Apr 15, 2010 13:13
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?
Re: OFFFGL
Posted: Fri Apr 16, 2010 14:43
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!
Re: OFFFGL
Posted: Mon Apr 19, 2010 14:01
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);
}
Re: OFFFGL
Posted: Mon Apr 19, 2010 15:25
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
Re: OFFFGL
Posted: Sun Jun 06, 2010 01:13
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..
