mipmapping using glCopyTexImage2D

glCopyTexImage2D theorically supports mipmapping, but whenever I try to use it, I get a black screen. Here is my code:

glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
do
{
glCopyTexImage2D (GL_TEXTURE_2D, level, GL_RGB,
0, 0,
nWidth, nHeight, 0);
nWidth = mMAX(nWidth/2, 1);
nHeight = mMAX(nHeight/2, 1);
level++;
} while (nWidth > 1 || nHeight > 1);

if I use GL_LINEAR instead of GL_LINEAR_MIPMAP_LINEAR, then it works just fine. So my level 0 is ok, but mipmaping doesn’t occur properly. Any clue why?

u should just enable automatic mipmap generation (i forget the comand) + then just update level0 (the rest of levels will get updated)

If you’re thinking of gluBuild2DMipmaps, I though of it, but I can’t specify the data because it’s the frame buffer and it’s requiering an adress in main memory.

If you’re talking about another command, I don’t know about it.

Hi, I didn’t try it, but maybe

glTexParameteri( GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS, GL_TRUE );

is what you’re searching for…

-ag

Sweet! This is what I needed. It tried and it works!

Thanks!