Quantcast
Channel: beginners - openFrameworks
Viewing all articles
Browse latest Browse all 4929

Drawing into an ofTexure

$
0
0

@Hennio wrote:

I've been using OF for a while now, but I've never had this need before.

Load an ofImage from file, and try to draw some shapes / stuff on top of the image, using the GPU, not modifying the individual pixels.

The way I would go at it would be to create an ofFbo the same widthheight as the ofTexture, draw the ofTexture in it, draw the other stuff on top, and convert back to ofImage and save.

// code not tested
ofImage image ("test.png");
ofFbo fbo;
fbo.allocate(image.getWidth(), image.getHeight());
fbo.begin();
    image.draw(0,0);
    // draw more stuff
fbo.end();
ofImage save;
fbo.readToPixels(save.getPixels());
save.save("test_stuff.png");

Are there other ways of doing this, more efficient etc?

Thanks!

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4929

Trending Articles