Austrian Coder
01-31-2003, 03:37 AM
Hallo!
I use S3TC compression for my app. It seems to work fine, but I can not generate mipmaps http://www.opengl.org/discussion_boards/ubb/frown.gif
if (m_Compression && m_CompressionLevel != None)
{
// here a more advanced way
if (mipmap)
{
// At this point we must check if the image format is RGB or RGBA
if (temp->type == RGB)
{
// Here we only can do DXTC1 compression
gluBuild2DMipmaps (GL_TEXTURE_2D, temp->bpp, temp->width, temp->height, 0x83F0, GL_UNSIGNED_BYTE, temp->data);
}
else
{
// so here we can use any supported DXT-compression
switch (m_CompressionLevel)
{
case S3TC_DXTC1:
gluBuild2DMipmaps (GL_TEXTURE_2D, temp->bpp, temp->width, temp->height, 0x83F1, GL_UNSIGNED_BYTE, temp->data);
case S3TC_DXTC3:
gluBuild2DMipmaps (GL_TEXTURE_2D, temp->bpp, temp->width, temp->height, 0x83F2, GL_UNSIGNED_BYTE, temp->data);
case S3TC_DXTC5:
gluBuild2DMipmaps (GL_TEXTURE_2D, temp->bpp, temp->width, temp->height, 0x83F3, GL_UNSIGNED_BYTE, temp->data);
};
}
}
else
{
// At this point we must check if the image format is RGB or RGBA
if (temp->type == RGB)
{
// Here we only can do DXTC1 compression
glTexImage2D (GL_TEXTURE_2D, 0, 0x83F0, temp->width, temp->height, 0, temp->type, GL_UNSIGNED_BYTE, temp->data);
}
else
{
switch (m_CompressionLevel)
{
case S3TC_DXTC1:
glTexImage2D (GL_TEXTURE_2D, 0, 0x83F1, temp->width, temp->height, 0, temp->type, GL_UNSIGNED_BYTE, temp->data);
case S3TC_DXTC3:
glTexImage2D (GL_TEXTURE_2D, 0, 0x83F2, temp->width, temp->height, 0, temp->type, GL_UNSIGNED_BYTE, temp->data);
case S3TC_DXTC5:
glTexImage2D (GL_TEXTURE_2D, 0, 0x83F3, temp->width, temp->height, 0, temp->type, GL_UNSIGNED_BYTE, temp->data);
};
}
}
}
I use S3TC compression for my app. It seems to work fine, but I can not generate mipmaps http://www.opengl.org/discussion_boards/ubb/frown.gif
if (m_Compression && m_CompressionLevel != None)
{
// here a more advanced way
if (mipmap)
{
// At this point we must check if the image format is RGB or RGBA
if (temp->type == RGB)
{
// Here we only can do DXTC1 compression
gluBuild2DMipmaps (GL_TEXTURE_2D, temp->bpp, temp->width, temp->height, 0x83F0, GL_UNSIGNED_BYTE, temp->data);
}
else
{
// so here we can use any supported DXT-compression
switch (m_CompressionLevel)
{
case S3TC_DXTC1:
gluBuild2DMipmaps (GL_TEXTURE_2D, temp->bpp, temp->width, temp->height, 0x83F1, GL_UNSIGNED_BYTE, temp->data);
case S3TC_DXTC3:
gluBuild2DMipmaps (GL_TEXTURE_2D, temp->bpp, temp->width, temp->height, 0x83F2, GL_UNSIGNED_BYTE, temp->data);
case S3TC_DXTC5:
gluBuild2DMipmaps (GL_TEXTURE_2D, temp->bpp, temp->width, temp->height, 0x83F3, GL_UNSIGNED_BYTE, temp->data);
};
}
}
else
{
// At this point we must check if the image format is RGB or RGBA
if (temp->type == RGB)
{
// Here we only can do DXTC1 compression
glTexImage2D (GL_TEXTURE_2D, 0, 0x83F0, temp->width, temp->height, 0, temp->type, GL_UNSIGNED_BYTE, temp->data);
}
else
{
switch (m_CompressionLevel)
{
case S3TC_DXTC1:
glTexImage2D (GL_TEXTURE_2D, 0, 0x83F1, temp->width, temp->height, 0, temp->type, GL_UNSIGNED_BYTE, temp->data);
case S3TC_DXTC3:
glTexImage2D (GL_TEXTURE_2D, 0, 0x83F2, temp->width, temp->height, 0, temp->type, GL_UNSIGNED_BYTE, temp->data);
case S3TC_DXTC5:
glTexImage2D (GL_TEXTURE_2D, 0, 0x83F3, temp->width, temp->height, 0, temp->type, GL_UNSIGNED_BYTE, temp->data);
};
}
}
}