Filling a rectangle with a texture

I’ve looked around everywhere trying to figure this out and can’t seem to get it.

I have a small 96x96 pixel.jpg image and I would like to load it as a texture and use it to fill a much larger rectangle (about 500 by 500 pixels).

I am able to load it as an ofImage and draw it normally. I have tried getting a texture reference from the image and then calling bind(), then drawing an ofRect(x, y, width, height). The rectangle just appears as having uniform color, similar in color to the image, but no texture data at all. Just one single color.

I am using the latest openFrameworks with Mac OSX Lion.

Any tips?! What is the proper way to use textures to fill simple shapes?


look at the textureScreengrabExample that comes with OF. it does not load in an image file but it uses a screen grab and texture maps that. if i remember that right.
so it shows you how to load data in to a texture.

maybe that helps.