Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: DDS files and S3TC?

  1. #1
    Member Regular Contributor
    Join Date
    Feb 2000
    Location
    Germany
    Posts
    261

    DDS files and S3TC?

    Hi @ll!
    I have got a few questions related to DDS files (I use the format because of S3TC)!

    1. How can I get the EXACT size of the buffer in which I can store the texture data of the DDS file? I currently use the following code:

    if(ddsd.dwMipMapCount > 1)
    {
    int TempWidth = ddsd.dwWidth;
    int TempHeight = ddsd.dwHeight;

    for(int i = 0; i < (int)ddsd.dwMipMapCount; i++)
    {
    BufSize += ceil(TempWidth / 4) * ceil(TempHeight / 4) * TempTexture.BlockSize;

    TempWidth >>= 1;
    TempHeight >>= 1;
    }

    But now the problem, if there are mipmaps smaller than 4*4 pixels the result of ceil(TempWidth / 4) * ceil(TempHeight / 4) * TempTexture.BlockSize is zero. I know that I have to handle all mipmaps smaller than 4*4 with S3TC as 8 Byte blocks (when using them as OGL textures), but I canīt read them in as 8 Byte blocks, or? Anyone got an idea for me?

    2. Where can I get the MS Tool for creating DDS files? I know itīs in the DX SDK, but I donīt want to download or order the SDK.

    Diapolo

  2. #2
    Member Regular Contributor
    Join Date
    Feb 2000
    Location
    Germany
    Posts
    261

    Re: DDS files and S3TC?

    I really need some help. Is there no one who knows how to handle these DDS files??????

    Diapolo

  3. #3
    Junior Member Newbie
    Join Date
    Jul 2000
    Posts
    27

    Re: DDS files and S3TC?

    I'm using such a piece of code:

    RTASSERT( gl_interface.StateVector.SupportsARB_texture_compr ession() );
    //S3TC format
    RTASSERT( gl_interface.StateVector.SupportsEXT_texture_compr ession_s3tc() );
    int ddw= w, ddh= h;
    const CHAR_ARRAY& Data= Data_;
    const char* p= Data.Begin();
    for (int m= 0; mips ? m<mips : m==0; ++m)
    {
    const int sz= ((ddw+3)/4)*((ddh+3)/4)*(itf==BITMAPIO::ITF_S3TC_DXT1?8:16);
    RTASSERT( p+sz<=Data.Begin()+Data.Size() );
    gl_interface.StateVector.CompressedTexImage2DARB(m ,glitf,ddw,ddh,0,sz,p);
    p+= sz;
    ddw/=2; ddh/=2; if (!ddw) ddw=1; if (!ddh) ddh=1;
    }
    GLRESULT( glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, mips ? minFilter : magFilter) );
    GLRESULT( glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, magFilter) );
    GLRESULT( glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT) );
    GLRESULT( glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT) );
    if (gl_interface.StateVector.SupportsEXT_texture_filt er_anisotropic())
    GLRESULT( glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, maxAnisotropy) );
    }

    Other info, including DDS creator is available on www.s3devrel.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •