Skip to content

Instantly share code, notes, and snippets.

@Craigson
Last active August 29, 2015 14:18
Show Gist options
  • Select an option

  • Save Craigson/0a896ea155fa85ee81e4 to your computer and use it in GitHub Desktop.

Select an option

Save Craigson/0a896ea155fa85ee81e4 to your computer and use it in GitHub Desktop.
oF code to cinder code
oFsetup(){
for(int i = 0; i < n; i++) {
ofTexture cur;
cur.allocate(512, 512, GL_RGB);
textures.push_back(cur);
}
}
oFdraw(){
int i = ofMap(mouseX, 0, ofGetWidth(), 0, textures.size() - 1, true);
textures[i].draw(0, 0);
}
cinder:
void VideoBufferApp::prepareSettings(Settings *settings){
settings->setWindowSize(512,512);
settings->setFrameRate(60);
}
void VideoBufferApp::setup()
{
// each 512x512x3 texture is about .7MB
// so n = 512 will use about 400MB of texture memory
int n = 512;
gl::Texture::Format format;
for(int i = 0; i < n; i++) {
gl::Texture cur = gl::Texture(512, 512, format);
textures.push_back(cur);
}
}
void VideoBufferApp::draw()
{
// clear out the window with black
//gl::clear( Color( 0, 0, 0 ) );
for (int i = 0; i < 512; i++){
gl::draw(textures[i],Vec2f(0, 0));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment