Game Development Community

MipMap Issue

by William Todd Scott · in Torque Game Engine · 01/25/2006 (10:12 am) · 4 replies

Hi,

I have loaded geometry from a custom file format and rendering. Everything is working fine with the exception of MipMapping. It isn't happening.

Can someone point out if there is anything wrong with the following steps I am taking:

When the file is loaded I create a texure like this:
m_TextureHandles[0] = TextureHandle(fileName, BitmapTexture);


When objectRender is called I set the texture like this:
glEnable(GL_TEXTURE_2D);
 glEnable(GL_CULL_FACE);
 glEnable(GL_ALPHA_TEST);
 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);


 glBindTexture(GL_TEXTURE_2D, m_TextureHandles[0].getGLName());

Thanks
Todd

Edit:
I should have pointed out that I am using .png files.

Also, I just noticed the following snippet in the png loader:

allocateBitmap(width, height,
false, // don't extrude miplevels...
format); // use determined format...

Are miplevels not created for textures loaded from .png files?
If so, why?

Thanks
Todd

#1
01/25/2006 (10:36 am)
I've seen mipmapping turn off if the textures were not powers of two on each side.
i'd be surprised if it's a png issue. try a jpg tho if you think that might be the problem.
#2
01/25/2006 (10:37 am)
Ahhh...I just figured this out...

It needs to be loaded as a DetailTexture not a Bitmaptexture
#3
01/25/2006 (11:07 am)
Actually, I think a MeshTexture will do what you want.

Are you making sure that the texture is pow2 and that nothing is turning off mipmapping?
#4
01/25/2006 (11:33 am)
It started working when I changed to DetailTexture.

I am switching it to a MeshTexture on your recommendation, given that I haven't explored the full implication of making it a DetailTexture.

Thanks for the help.
Todd