Mipmapping problem

Hi,

I have been trying to get mipmapping to work. I finally got something out of gluBuild2DMipmaps() - there’s a slight problem with the image data format. This kind of works, but it doesn’t look like it’s working as I still get a strobing effect no matter what I set the minification filter to.

I have also implemented my own code to produce my mipmaps, but this just slowed down to a total crawl - 0 to 1 FPS.

Is anybody else getting this problem or had it?

I’m using Win2k and Graphics Blaster Riva TNT card.

Thanks,
Luke A. Guest.

>gluBuild2DMipmaps()
gluBuild2DMipmaps(GL_TEXTURE_2D
,TargetFormat,Width,height
,YourTexFormat,GL_UNSIGNED_BYTE,Texture);

>I have also implemented my own code to
>produce my mipmaps, but this just slowed
>down to a total crawl - 0 to 1 FPS.

Do you build your mipmaps for evry frame?
I advise You to look under Coding in http://www.opengl.org

Nope, I’m not building the mipmaps on every frame.

I build them on creation of the texture and when the textures need to be rebuilt - i.e. if I change the resolution - they are rebound.

Thanks,
Luke.

Originally posted by CS:
[b]
>I have also implemented my own code to
>produce my mipmaps, but this just slowed
>down to a total crawl - 0 to 1 FPS.

Do you build your mipmaps for evry frame?
I advise You to look under Coding in http://www.opengl.org [/b]

As I have already stated, the mipmaps are not built on every frame and the speed is terrible on my self made ones.

This does not explain why if I use Build2DMipmaps(), the speed is fine. Also I do get strobing effects on a brickwork texture, which makes me think that it isn’t working anyway - I am checking the return value and it is returning 0!

HELP?

Thanks,
Luke.


The speed is terrible on my self made ones.
If I use Build2DMipmaps(), the speed is fine.

As Build2DMipmaps works and Yours not - your code must have some bugs. Can You show your code?

<CS>

Originally posted by CS:
[b] As Build2DMipmaps works and Yours not - your code must have some bugs. Can You show your code?

<CS> [/b]

Actually, I don’t think it is working. That’s what I’m trying to say. It doesn’t give me any errors - but it does have really bad strobing on the brickwork. Is there a way to change the filter on gluBuild2DMipmaps() so that it is linearly interpolated?

As for code, I’m at home at the moment - I might be able to post a bit as it is for work. I’ll have to see.

Thanks,
Luke.

Ok, I had a thought, if my texture is 256x256, I just halve the texture until I get my levels, right?

So, I have 256x256 -> 128x128 -> 64x64 -> 32x32 -> 16x16 -> 8x8 -> 4x4 -> 2x2 -> 1x1.

I don’t need to have any strange intermediate ones, do I?

Also, I’m creating all of my levels from my first one rather than taking the level before and scaling it to make the next. Is this correct, or does it not matter at all?

Thanks,
Luke.

Hi!

I don’t belive that gluBuild2DMipmaps does’t work!

Use (for testing) GL_LINEAR_MIPMAP_LINEAR for minification - so
You will see a smooth fade from one mipmap level to other. If there is a error
You will see that. (But be warned that it may be wery slow.)

Be sure you tell your texture format right. If You say …
gluBuild2DMipmaps(GL_TEXTURE_2D,GL_RGBA,256,256,GL_RGB,GL_UNSIGNED_BYTE,Tex);
… and your texture format is GL_RGBA You will see some crap on screen.

> I don’t need to have any strange intermediate ones, do I?
No.

> Also, I’m creating all of my levels from my first one …
That is not good. Use previous one (easier to scale).
> … rather than taking the level before and scaling it …
How? MipMaping makes no sence if You skip some texels.
> … to make the next.
> Is this correct, or does it not matter at all?
What do you mean with “does not matter at all”?
Of couse it does matter how You build mipmaps -
as You may make them wronq (and I think that is the case ).

At last I will guide You to a page that may help. So from … http://www.opengl.org
-> Coding
-> OpenGL Programming Guide Version 1.0
-> Chapter 9 Texture Mapping
It’s the best guide i have ever seen (short - only important things).
… and there You find code that works.

NB! My english is bad - so be patient .

<CS>