HelloWorld test

when you call:

  
ofRunApp(new HelloWorldApp);  

is this calling the class? How would I go about even finding this out, is there a logical way of checking documentation on OF website? I don’t really know the workflow of “backwards engineering.” I feel like a total newbie at this. ugg. trying to make it through Joshua Nobles book and ended up going back through the basics. I feel like I might need even more basics than this book.

any suggestions?

I’m asking this because I am going on to the second example of drawing simple shapes and am Getting an error, there is no code examples for main.cpp so I made my own. I seem to be getting all sorts of errors, here is what I have so far:

simpleGraphics.h:

  
#pragma mark once  
  
#include "ofMain.h"//include oF’s ofMain class, linked here  
  
class simpleGraphics : public ofBaseApp{  
	  
public:  
	void setup();  
	void update();  
	void draw();  
	  
	ofColor fillColor;  
}  

main.cpp:

  
#include "ofMain.h"  
int main(){  
	// ofAppGlutWindow window;  
	ofSetupOpenGL(300,368, OF_WINDOW); //experiment with sizes  
									   // <-------- setup the GL context  
									   // this kicks off the running of my app  
									   // can be OF_WINDOW or OF_FULLSCREEN  
									   // pass in width and height too:  
	ofRunApp(new simpleGraphics);  
}  

simpleGraphics.cpp:

  
#include "singleGraphics.h"  
void simpleGraphics::setup()  
{  
	ofSetCircleResolution(100);  
	ofBackground(255, 255, 255);  
	ofSetVerticalSync(true)  
	  
	fillColor.set(255, 0, 0)  
}  
  
void simpleGraphics::update() {  
	fillColor.setHue(fillColor.getHue()+1);  
	if (fillColor.netHue>254) {  
		fillColor.setHue(0);  
	}  
}  
  
void simpleGraphics::draw(){  
	ofBackground(255, 255, 255);  
	ofSetColor(fillColor);  
	ofFill();  
	ofCircle(100,400,100);  
	  
	ofNoFill();  
	ofSetLineWidth(10);  
	ofSetColor(fillColor);  
	ofCircle(400, 400, 200)  
}  

This line:

  
ofRunApp(new HelloWorldApp);  

makes an instance of the HelloWorldApp, it really should be:

  
ofRunApp(new HelloWorldApp());  

which makes it much clearer.

Your main() method needs to look like this:

  
  
ofAppGlutWindow window; // this is important  
ofSetupOpenGL(&window, 1024,768, OF_WINDOW); // this is important  
ofRunApp( new app()); // this is important  
  

I’m not sure O’Reilly didn’t put main.cpp in the code downloads, I’ll get that update b/c it’s annoying. The best thing to do generally speaking, is to work from a previously set up project or one of the generators (which one you use will depend on your OS, check here http://www.openframeworks.cc/setup/) because getting a new project configured is a pain.

@Lukasz, cold enough there in Grand Rapids for ya (I’m from MI too)?! :wink:

Joshua’s right, there are many great examples that are included in oF that can get you up and running in minutes that cover a range of topics from graphics, video, sound, etc. …minus compilation errors, whoohoo! :wink:

See this link below on their Wiki Documentation page referring to PLAYing with the examples:
http://wiki.openframeworks.cc/index.php?title=OF-Start-Up-Guide#Getting-Started
It also explains what files to look for depending on what system you’re using; Win, Mac, Linux, etc.

Another page I recommend, after playing around with their examples (have fun first!), is this link:
http://wiki.openframeworks.cc/index.php?title=Image-processing
Very important to understand how oF stores the pixel data of an image; before trying this code, I suggest to scroll down this page to see the very pretty diagrams which make you say, “Ahhh, I get it, cooL!”.

@Joshua - I’m not aware of the books out there for oF and mainly rely on the web/oF forums to get my documentation/sample code (outside of the existing oF examples), so I’ll have to check it out, thanx! :slight_smile:

For future reference the code for Programming Interactivity is going to have a home here: https://github.com/joshuajnoble/Programming-Interactivity-Code which might make it a little easier to work with. As soon as I get some time I’ll add projects for CodeBlocks (win/lin) + XCode.

CooL! How nice…downloaded !! …will buy book soon… :slight_smile:

woah, this will make my life a lot simpler. nice to have a cross reference when I type something wrong. much appreciated.

great stuff! thanks for link.