Texture not correctly bound if ofDisableArbTex() is called after loading an image

I just figured out if I call ofDisableArbTex() after loading an image, the image’s texture is not correctly bound to shapes.

First, Here’s my code that works

//--------------------------------------------------------------
void ofApp::setup(){
    ofDisableArbTex();
    ofEnableDepthTest();
    image.load("background.jpg");
}

//--------------------------------------------------------------
void ofApp::update(){

}

//--------------------------------------------------------------
void ofApp::draw(){
    image.draw(0, 0, 300, 200);
    image.bind();
    ofTranslate(400, 300);
    ofRotateXDeg(60);
    ofDrawBox(200);
    image.unbind();
}

This is the screenshot when I run the code.

However, if I load an image before calling ofDisableArbTex(),

//--------------------------------------------------------------
void ofApp::setup(){
    image.load("background.jpg");
    ofDisableArbTex();
    ofEnableDepthTest();  
}

The image is not correctly bound to the box shape.

Is this an intended behavior? Or would this be a bug that should be fixed?

this is intended behaviour, ofDisableArbTex tells ofTexture to allocate GL_TEXTURE_2D by default instead of GL_TEXTURE_RECT. Once the texture is allocated changing ofDisableArbTex has no effect on that texture

1 Like

Thank you @arturo