Skip to content

Instantly share code, notes, and snippets.

@armadillu
Created June 23, 2014 17:16
Show Gist options
  • Save armadillu/d499f6a2673dd560660d to your computer and use it in GitHub Desktop.
Save armadillu/d499f6a2673dd560660d to your computer and use it in GitHub Desktop.
ofImage img;
ofPBO pbo;
ofTexture pboTex;
void setup(){
//get some pixels from disk
img.setUseTexture(false); //no gpu upload
img.loadImage("crap8192.jpg");
//alloc pbo destination tex
pboTex.allocate(img.getWidth(), img.getHeight(), GL_RGB8 ); //from pixels, allocate tex (but dont upload to gpu)
//alloc pbo
pbo.allocate(pboTex, 1);
pbo.loadData(img.getPixelsRef(), true);
}
void testApp::update(){
pbo.updateTexture();
}
void testApp::draw(){
pboTex.draw(0,0, ofGetWidth(), ofGetHeight());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment