PDA

View Full Version : mipmapping using glCopyTexImage2D



vince
01-18-2006, 07:31 AM
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?

zed
01-18-2006, 01:28 PM
u should just enable automatic mipmap generation (i forget the comand) + then just update level0 (the rest of levels will get updated)

vince
01-19-2006, 05:00 AM
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.

AnselmG
01-19-2006, 07:06 AM
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

vince
01-19-2006, 09:06 AM
Sweet! This is what I needed. It tried and it works!

Thanks!