summaryrefslogtreecommitdiff
path: root/offsetProject/src/imageStore.h
diff options
context:
space:
mode:
authorTim Redfern <tim@eclectronics.org>2014-03-14 16:54:16 +0000
committerTim Redfern <tim@eclectronics.org>2014-03-14 16:54:16 +0000
commitd1abb8fcf4784aa1a7b778abf6e237d71d1da7c7 (patch)
treeea73c0957df69661af44198eef03038344cceda6 /offsetProject/src/imageStore.h
parent2438e0a034d7ef50c8d7837ea415ca6a95a94fc0 (diff)
fix texture delete bug
Diffstat (limited to 'offsetProject/src/imageStore.h')
-rw-r--r--offsetProject/src/imageStore.h18
1 files changed, 12 insertions, 6 deletions
diff --git a/offsetProject/src/imageStore.h b/offsetProject/src/imageStore.h
index 58ef560..6355c9d 100644
--- a/offsetProject/src/imageStore.h
+++ b/offsetProject/src/imageStore.h
@@ -33,7 +33,7 @@ class imageStore : public ofThread{
vector<ofImage*> imageptrs;
deque<std::string> to_update;
bool newinstagram;
- ofImage instagram_image;
+ ofImage instagram_image,instagram_image2;
float newinstagramtime;
//Matrix<float> dataset; doesn't need to be retained?
@@ -175,6 +175,7 @@ class imageStore : public ofThread{
bool new_instagram(){
if (newinstagram){
if( lock() ){
+ instagram_image=instagram_image2;
loadtexture(instagram_image);
newinstagram=false;
newinstagramtime=ofGetElapsedTimef();
@@ -198,7 +199,9 @@ class imageStore : public ofThread{
if( lock() ){
int size=ceil(ofGetHeight()/MAX_TILE_SIZE)*FLANN_MATRIX_SIZE;
- ofImage imm=instagram_image;
+ ofImage imm;
+ imm.setUseTexture(false);
+ imm=instagram_image;
imm.resize(size,size);
uint8_t* cptr=imm.getPixels();
for (int i=0;i<size;i++){
@@ -274,7 +277,9 @@ class imageStore : public ofThread{
//cout << "response " <<response["data"][i]["caption"]["id"].asString()<< endl;
if (images.find(response["data"][i]["caption"]["id"].asString())==images.end()){
+ cerr<<"got response"<<endl;
std::string url = response["data"][i]["images"]["standard_resolution"]["url"].asString();
+ cerr<<"got url"<<endl;
std::string id = response["data"][i]["caption"]["id"].asString();
cout<<"fetching "<<id<<":"<<instagram_url<<endl;
@@ -282,13 +287,14 @@ class imageStore : public ofThread{
img.setUseTexture(false);
img.loadImage(url);
if( lock() ){
- instagram_image=img;
- unlock();
- }
+ instagram_image2.setUseTexture(false);
+ instagram_image2=img;
+ // unlock();
+ //}
img.resize(IMAGE_STORE_SIZE,IMAGE_STORE_SIZE);
img.saveImage(ofToString(IMAGE_STORE_SIZE)+"/"+id+".png");
img.resize(MAX_TILE_SIZE,MAX_TILE_SIZE);
- if( lock() ){
+ //if( lock() ){
newinstagram=true;
colours[id]=get_colour(img);
add_data(img);