Image tiling / repeating textures

This used to work, but now it defaults to GL_CLAMP_TO_EDGE

  
  
img.getTextureReference().setTextureWrap(GL_REPEAT, GL_REPEAT);  
img.width  = ofGetWidth();  
img.height = ofGetHeight();  
img.draw(0, 0);  
  

Even ofSetTextureWrap(GL_REPEAT, GL_REPEAT) is ineffective now.
Any ideas?

Try

ofDisableArbTex();
img.loadImage( “img.png” );
img.getTextureReference().setTextureWrap( GL_REPEAT, GL_REPEAT );
img.width = ofGetWidth();
img.height = ofGetHeight();

*disable BEFORE you load image.

1 Like

Thanks @hrs - I tried this and now the texture doesn’t load at all.

Which OF and OS version?
I can still repeat image with OSX10.10 + OF 0.8.4 (both of ofGLProgrammableRenderer and ofGLRenderer).
Here is simple test code.

@hrs thanks! That does work. I didn’t try it that way.

But my aim is to be able to translate the texture without moving the primitive. Here is what I have been trying to do:

And here are the results… First with ofDisableArbTex() removed:

And here with ofDisableArbTex() included:

That actually is doing what you told it to do but non-ARB texture coords are normalized, i.e. go from 0 to 1, while ARB texture coords are in pixels, i.e. 0 to 512. Hope that helps.

@joshuajnoble Thanks for that insight - it works!

3 Likes