summaryrefslogtreecommitdiff
path: root/offsetProject/src/ofApp.cpp
blob: 00c7f57018ceeef3e830d653938410828a7aebef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#include "ofApp.h"

/*
so far so good, NOW

threading

parse response and identify new pictures
save pictures & metadata - rather than reloading each time?
local images format
do we need any metadata? I guess not other than to know the tag id
could save with the tag id as the name of file, simpler

how exactly do we parse or mipmap the images
do we worry about memory - I guess not

identify the images

image save- reload system (? even necessary ?)
camera + button
transitions

should the loader own the images?
should the whole image bank be locked while loading?
alternatively each image could have a lock? - threadedImage

or true mip map via drawsubsection?

start with a max size say 64 - should be 16k inc mip maps

graphics card has 2048MB
9% in use by ubuntu
117964 textures
I wonder is this faster with shared memory..

load app
get list of images in defined folder
load them and create mip maps
store indexed by file stub

when a new image comes in
load and create mip maps
save to 

*/
//--------------------------------------------------------------
void ofApp::setup() {
	ofSetLogLevel(OF_LOG_WARNING);
		
	ofSetFrameRate(60);

	ofDirectory image_path(ofToString(IMAGE_STORE_SIZE)+"/");
	cerr<<"image path: "<<image_path.getAbsolutePath()<<endl;
	if (image_path.exists()){
		image_path.listDir();
		cerr<<"image path found, "<<image_path.size()<<" images"<<endl;
		for (int i=0;i<image_path.size();i++){
			cerr<<image_path.getFiles()[i].getFileName()<<endl;
		}
	}
	else {
		cerr<<"creating image path"<<endl;
		image_path.create();
	}
	
	mode=MODE_COLOURTILES;

	fullscreen=false;
}

//--------------------------------------------------------------
void ofApp::update() {
	
	ofSetWindowTitle(ofToString(ofGetFrameRate()));
	
	
}



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

	ofBackground(0,0,0);

	ofSetColor(255, 255, 255);

	
    
}



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

	
}

//--------------------------------------------------------------
void ofApp::keyPressed (int key) {
	switch (key) {
			
		
		case OF_KEY_LEFT:
			mode--;
			if (mode<0) mode==NUM_MODES-1;
			break;

		case OF_KEY_RIGHT:
			mode=(mode+1)%NUM_MODES;
			break;

		case ' ':
			fullscreen=!fullscreen;
			ofSetFullscreen(fullscreen);
			break;

	}
}

//--------------------------------------------------------------
void ofApp::mouseDragged(int x, int y, int button)
{}

//--------------------------------------------------------------
void ofApp::mousePressed(int x, int y, int button)
{}

//--------------------------------------------------------------
void ofApp::mouseReleased(int x, int y, int button)
{}

//--------------------------------------------------------------
void ofApp::windowResized(int w, int h)
{}