Drawing to an ofImage, FBO, texture, whatever...

Hi all,
First off, thanks for this great library and forum. Excellent stuff here. I’m trying to work on an iterative algorithm that needs to draw a bunch of circles to an ofImage, and then use that image pixel data for the next step which grabs pixel data out of that ofImage and repeats. In essence, it would be fantastic for me to be able to put an ofCircle() onto an ofImage with ease and maintain normal pixel buffer access. Obviously this isn’t how OF is designed upfront.

I’ve done a lot of reading here about FBOs and whatnot. Basically, I need the best way to be able to draw shapes to a buffer, and then be able to easily access that RGB data afterwards, and in the end, draw everything to the screen.

I tried the ofxFBOTexture class from here:

And messed with the getPixels() function posted within that thread. My problem with the getPixels() routine there is that when I get the pixels and set them to an ofImage, the size of it drawn is exactly 1/2 the size of the actual FBO.

For instance, if I load an ofImage of something, set it to the FBO, and then draw the FBO to the screen, it draws exactly as expected. If I set the pixels to the FBO, then call that getPixels() routine and set the pixels into a new ofImage and draw it, its half the width/size. If someone could help me fix this, it would probably be the answer.

Also, if there are other ways to go about this, I’m all ears.


just a quick hint:
maybe your setFromPixels vars are wrong. especially have a look at width, height and type. maybe you used a wrong type or got an mixup in the width and heigt.

with an excerpt of your code it would be easier to see the problem.