How can I draw a texture image without displaying it

Hello,

I would like to draw an image then use it as a texture on a mesh. I would like to draw the image using regular geometry drawing functions such as drawCircle (from ofPath or ofGraphics).

I cannot find a way to create the image without actually displaying it in the window.

I looked into ofImage which can be used as a texture, but could not find how to draw into it, except by manipulating pixels (getPixels).

I also looked in ofGLRenderer, but not sure if I can use this out of the display window.

Thank you

Hey @xmenage,

I believe you want to use a FBO.


void ofApp::setup(){
  int const kNumMSAASamples = ofFbo::maxSamples();
  fbo_.allocate(ofGetWidth(), ofGetHeight(), GL_RGBA, kNumMSAASamples);
}

void ofApp::draw(){
  // Render into FBO.
  fbo_.begin();
    ofClear( ofFloatColor(0.125f) );
    ofSetColor(255, 0, 0);
    ofDrawCircle(ofGetWidth()/2, ofGetHeight()/2, 64);
  fbo_.end();

  // Draw the FBO to screen.
  ofSetColor(255);
  fbo_.draw(0, 0);
}

It works, thank you @DarkSalmon