Help....!Build succeded but empty scean..!

#1

Hi, I am a graphic design department student…
today I met super cool open source(https://github.com/junkiyoshi/Insta20190312/blob/master/ofApp.h).
so I tried to build this… this is my first time.
build was succeded but it is empty.
I used projectGenerator and deleted main.cpp file because that source have things about “main”? in ofApp.cpp file.
so I thought this is problem, so I made main.cpp file again, and deleted things about “main” ( //--------------------------------------------------------------

int main() {

ofSetupOpenGL(720, 720, OF_WINDOW);

ofRunApp( new ofApp());

})

but still empty!
should I modify more? then what?
I really want to try those things…
please help…

#2

Just create a empty sketch with projectGenerator and copy/paste the code from ofApp.h and ofApp.cpp. Also you need to download the font file and create “fonts” folder inside bin/data. Copy the font inside “fonts” folder and build the sketch.

#3

hi thank you very much…!
yes i did…
but


empty…

#4

hi. do you get any output in the console?
can you draw anything?
for instance, if you put inside the draw() function something like

ofSetColor(ofColor::red);
ofDrawCircle (100,100,100);

do you get anything?

or simply try to draw with the loaded font.
font.drawString("blablabla", 200,200);

#5

Thank you very much…
but still not working…
should i modify something?
I just want to try how that working…
but still empty page.,.

thank you…

#6

and also they linked to debug page I think…
I build that after that they open debug page.,

#7

Do you get any console output ?? Post it here please.

#8

can you please post the whole code you are trying to run please? ofApp.h, ofApp.cpp and main.cpp

#9

thank you very much…

1:
#pragma once
#include “ofMain.h”

class ofApp : public ofBaseApp {

public:
void setup();
void update();
void draw();

void keyPressed(int key) {};
void keyReleased(int key) {};
void mouseMoved(int x, int y) {};
void mouseDragged(int x, int y, int button) {};
void mousePressed(int x, int y, int button) {};
void mouseReleased(int x, int y, int button) {};
void mouseEntered(int x, int y) {};
void mouseExited(int x, int y) {};
void windowResized(int w, int h) {};
void dragEvent(ofDragInfo dragInfo) {};
void gotMessage(ofMessage msg) {};

ofEasyCam cam;
ofTrueTypeFont font;
vector<glm::vec3> locations;

};

2:
#include “ofApp.h”

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

ofSetFrameRate(60);
ofSetWindowTitle("openframeworks");

ofBackground(239);
ofSetColor(39);
ofEnableDepthTest();

this->font.loadFont("fonts/Kazesawa-Bold.ttf", 450, true, true, true);

}

//--------------------------------------------------------------
void ofApp::update() {

ofSeedRandom(39);

}

//--------------------------------------------------------------
void ofApp::draw() {

this->cam.begin();
ofRotateX(180);

string word = "KIYOSHI";
for (int y = -1000; y <= 1000; y += 500) {

	float noise_seed_x = ofRandom(1000);
	float noise_seed_y = ofRandom(1000);
	auto path_list = this->font.getStringAsPoints(word, true, false);
	for (int point_index = 0; point_index < path_list.size(); point_index++) {

		auto outline = path_list[point_index].getOutline();
		ofBeginShape();
		for (int outline_index = 0; outline_index < outline.size(); outline_index++) {

			if (outline_index != 0) { ofNextContour(true); }

			outline[outline_index] = outline[outline_index].getResampledByCount(100);
			auto vertices = outline[outline_index].getVertices();
			for (int vertices_index = 0; vertices_index < vertices.size(); vertices_index++) {

				auto location = glm::vec3(vertices[vertices_index].x - this->font.stringWidth(word) * 0.5, y + vertices[vertices_index].y + this->font.stringHeight(word) * 0.5, 0);
				auto rotation_y = glm::rotate(glm::mat4(), ofMap(ofNoise(noise_seed_y, ofGetFrameNum() * 0.008 + (location.y + y) * 0.0005), 0, 1, -PI * 0.5, PI * 0.5), glm::vec3(0, 1, 0));

				location = glm::vec4(location, 0) * rotation_y;
				ofVertex(location);
			}
		}
		ofEndShape(true);
	}
}

this->cam.end();

}

//--------------------------------------------------------------
int main() {

ofSetupOpenGL(720, 720, OF_WINDOW);
ofRunApp(new ofApp());

}

#10

i didn’t modify anything.
I just used that link (https://github.com/junkiyoshi/Insta20190312/blob/master/ofApp.h)
:worried::worried:

#11

Hi,
first, edit the post with the code, select the text that is code and press the </> button that is in the toolbar. That will make it all to be shown as code and it will be easier to read.

Second, did you use the project generator to regenerate the project? There is this nasty thing in that code that places the main function inside ofApp.cpp.
Try making a new project with project generator, and open it.
copy into ofApp.h the following

#pragma once
#include “ofMain.h”

class ofApp : public ofBaseApp {
public:
void setup();
void update();
void draw();

ofEasyCam cam;
ofTrueTypeFont font;
vector<glm::vec3> locations;

};

and into ofApp.cpp

#include "ofApp.h"

//--------------------------------------------------------------
void ofApp::setup() {
	ofSetFrameRate(60);
	ofSetWindowTitle("openframeworks");
	
	ofBackground(239);
	ofSetColor(39);
	ofEnableDepthTest();
	
	this->font.loadFont("Helvetica", 450, true, true, true);
	
}

//--------------------------------------------------------------
void ofApp::update() {
	ofSeedRandom(39);
}

//--------------------------------------------------------------
void ofApp::draw() {
	this->cam.begin();
	ofRotateX(180);
	
	string word = "KIYOSHI";
	for (int y = -1000; y <= 1000; y += 500) {
		
		float noise_seed_x = ofRandom(1000);
		float noise_seed_y = ofRandom(1000);
		auto path_list = this->font.getStringAsPoints(word, true, false);
		for (int point_index = 0; point_index < path_list.size(); point_index++) {
			
			auto outline = path_list[point_index].getOutline();
			ofBeginShape();
			for (int outline_index = 0; outline_index < outline.size(); outline_index++) {
				
				if (outline_index != 0) { ofNextContour(true); }
				
				outline[outline_index] = outline[outline_index].getResampledByCount(100);
				auto vertices = outline[outline_index].getVertices();
				for (int vertices_index = 0; vertices_index < vertices.size(); vertices_index++) {
					
					auto location = glm::vec3(vertices[vertices_index].x - this->font.stringWidth(word) * 0.5, y + vertices[vertices_index].y + this->font.stringHeight(word) * 0.5, 0);
					auto rotation_y = glm::rotate(glm::mat4(), ofMap(ofNoise(noise_seed_y, ofGetFrameNum() * 0.008 + (location.y + y) * 0.0005), 0, 1, -PI * 0.5, PI * 0.5), glm::vec3(0, 1, 0));
					
					location = glm::vec4(location, 0) * rotation_y;
					ofVertex(location);
				}
			}
			ofEndShape(true);
		}
	}
	
	this->cam.end();
}

In your project the should also be a main.cpp file. Just leave it there.
If this works change the typography to the custom one you want to use.

This is what I get

#12

Thank you so much…
but I don’t know why… I followed you but still empty…
I don’t know why… really…
but thank you…

#13

empty…

#14

oh!!! I deleted helvetica.ttf and just put helvetica!
then it is working!!
thank you very much!!

2 Likes
#15

Yes, Loadfont looks for the exact filename you specify.