"openFrameworks Essentials" book has been published

Our book openFrameworks Essentials by Denis Perevalov, Igor (Sodazot) Tatarnikov has been published by Packt Publishing.

The book is devoted to learning basics of openFrameworks by creating video synthesizer project along the book.

The book’s source codes are available for free downloading at the book’s page https://www.packtpub.com/application-development/openframeworks-essentials (“Code Files” button).

The sample chapter with the scheme of created video synthesizer is here: http://www.slideshare.net/Products123/openframeworks-essentials-sample-chapter


Super awesome!

1 Like

Great book for beginners!

Question about chapter 5:
In step 3 of “Drawing a solid sphere with shading” nothing but the gui appears when adding the following lines:


I tired commenting out combinations to see where the issue is, but don’t see where the issue is. I am using OF 0.8.4

Maybe I missed something but I don’t see it:

void ofApp::Draw3D()
	light.setPosition(ofGetWidth()/2, ofGetHeight()/2, 600);
    ofSetColor( ofColor::white );

The code from the download seems to work, but there are a few differences in the downloaded code and where I am currently in the chapter. I will continue on with the chapter to see if it clears up, but it doesn’t seem to work as it should in the order that it is presented now (again unless I missed a step).



Oh, the code looks correct. - Please, could you send me your whole sources - ofApp.h and ofApp.cpp? - in this topic or to perevalovds@gmail.com

Which OS are you using?


Hi I’m new on OF. I bought the book but I have a problem with chapter 6. When I launch the code I have this problem.

Someone can help me? thanks

Have a good day

the code doesnt compile from chapter 5 onwards, which is a shame =(

one error is with the line:
vertices0 = sphere.getMesh().getVertices();

and the error which is given is: no viable overloaded ‘=’

any help would be apreciated
thanks, jack

I have not read that book but it already has some years and openFrameworks has changed a bit.
In the case of your problem I am almost sure it is because OF has now switched to use GLM vector maths instead of using its own vector classes.
So, probably your vertices0 variable is of the type vector<ofVec3f>, which is what the getVertices() function used to return. Now, as I said, openFrameworks switched to GLM, thus this function returns a vector<glm::vec3>. So simply said, where ever you have declared your vertices0 object, which should read like vector<ofVec3f> vertices0; just change it for vector<glm::vec3> vertices0; .
Furthermore, in a lot of cases ofVec3f can automatically get converted back and forth to glm, but not when it is used in a container such as a vector. This said, the easiest thing to do is, when ever you come across to a vector<ofVec3f> object just change it to be vector<glm::vec3>.
Be aware though that the glm::vec3 is not compatible with the ofVec3f class regarding its methods, it will only work when you access its variables (x, y or z).

Last but not least, if you are not happy with changing to glm or having to fix the code to make it work, then go to the ofConstants.h file and change the line that reads #define OF_USE_LEGACY_VECTOR_MATH 0 to #define OF_USE_LEGACY_VECTOR_MATH 1

hope this helps.


Hello roy,

I am having issues with chapter 6 reading data from a text file. I am gettting an error that vector is out of range:

ofFile file;
ofBuffer buffer;
if ( buffer.isLastLine() ) buffer.resetLineReader();
string line = buffer.getNextLine();
vector values = ofSplitString( line, “\t” );
if ( values.size() >= 128 ) {
float value1 = ofToFloat(values[1]);
float value2 = ofToFloat(values[5]);
float value3 = ofToFloat(values[100]);
twistX = ofMap( value2-value1, -9400, -9100, -10, 10 );
twistY = ofMap( value3-value1, -1700, -1650, -10, 10 );

Is there any chance you have a solution to this issue as well? Thanks :smiley:

hi @Ioannis

The methods used in that example are deprecated. It does not mean these will not work but you should use the newer way of handling the ofBuffer object. Take a look at examples/input_output/fileBufferLoadingCSVExample.

When you have a vector out of range the app will crash and if you are in debug your IDE should show you the line where this happened.

Is that all the code? Are you actually loading something into the buffer?

When posting code, in the forum’s text input paste the code, select it and press the </> button that is in the toolbar. This will format the code into a much more readable format.

hello @roymacdonald,

I am quite a newbie in this forum thank you for pointing out how to post here!
The example is supposed to read a text and retreive data from it


//reading data from text file
ofFile file;
ofBuffer buffer;

ofApp.cpp setup

//reading data from text file - setup

in ofApp update:

if (buffer.isLastLine()) buffer.resetLineReader();
	string line = buffer.getNextLine();
	vector<string> values = ofSplitString(line, "\t");
	if (values.size() >= 128) {
		float value1 = ofToFloat(values[1]);
		float value2 = ofToFloat(values[5]);
		float value3 = ofToFloat(values[100]);
		twistX = ofMap(value2 - value1, -9400, -9100, -10, 10);
		twistY = ofMap(value3 - value1, -1700, -1650, -10, 10);

And the error I get:


I will have a look at the example but I am a little bit afraid since its the first time that I do something with files in OF and I dont have previous coding experience :blush:

Hi, the problem is in how you declare the for loop. Please post the complete code , as the problem seems to be not the code you posted