Mipmap texturing in 0.9 nightly?

Hey there,

I read that the use of mipmap is possible now in 0.9 also for uncompressed images. Is that right?
I checked the nightly builds and it seams included there, but setting:

#setup
ofLoadImage( mTex1,dir.getPath((int)ofRandom(-1,dir.numFiles())));
mTex1.setTextureMinMagFilter(GL_LINEAR_MIPMAP_LINEAR,GL_LINEAR );

#draw
mTex1.draw(0,0,0);

doesnt result in any changes. Do i have to do something more?

mipmaps won’t be noticeable if you draw the texture at it’s original size, try moving it further away in z for example like mTex1.draw(0,0,-100)

hey arturo,
sure it is only recognizable when smaller. The camera is moving, so it is really small at the beginning and gets bigger than.

oh, i see, no idea then. @tgfrerer ?

Maybe the mipmap was not generated at the point where you did draw the texture.

A Mipmap is only generated:

a) automatically, if you call mTex1.enableMipmap() before loading pixels into your texture
b) manually, if you call mTex1.generateMipmap() after you load your pixels into your texture.

Mipmap generation is costly (and in most cases happens on the CPU) which is why this only happens when loading or manually requested.

Cheers

Tim

Thanks for the explanation. That makes sense but is not working for me.

Here is my code:

void ofApp::setup(){
    mTex1.enableMipmap();
    ofLoadImage( mTex1,"test.jpg" );
    mTex1.setTextureMinMagFilter(GL_LINEAR_MIPMAP_LINEAR,GL_LINEAR);
    mTex1.generateMipmap();
    ofLoadImage( mTex2,"test.jpg" );
}

//--------------------------------------------------------------
void ofApp::draw(){
    mTex1.draw(-2000,0,-3100);
    mTex2.draw(500,0,-3100);
}

Ok, sorry guys.

Missed to call ofDisableArbTex() before generating the mipmaps.

void ofApp::setup(){
    ofDisableArbTex();
    mTex1.enableMipmap();
    mTex1.setTextureMinMagFilter(GL_LINEAR_MIPMAP_LINEAR,GL_LINEAR);
    ofLoadImage( mTex1,"test.jpg" );
    ofEnableArbTex();

    ofLoadImage( mTex2,"test.jpg" );
}