Results 1 to 7 of 7

Thread: Texture Compression

  1. #1
    Junior Member Newbie
    Join Date
    Dec 2009
    Posts
    12

    Texture Compression

    Hello all,

    Have come across a problem with texture compression in OpenGL that i can't get my head round.

    I'm trying to load a DXT3 texture. The system finds the texture and loads it without error but it is rendered 'white'.

    I created the dds file from a .tga using NVDIA texture tools and and ATI TheCompressonator and the issue is the same in both cases.

    This is the code I use to define the texture. in_pCompressedTextureFile is a pointer to my dds file reader. The dds file contains only the main texture, with no mipmaps.

    Code :
     
        glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
        glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
     
        int iWidth = in_pCompressedTextureFile->GetWidth();
        int iHeight = in_pCompressedTextureFile->GetHeight();
        int iSize = ( ( iWidth + 3 ) / 4 ) * ( ( iHeight + 3 ) / 4 ) * 16;
        glCompressedTexImage2D( GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, iWidth,iHeight , 0, iSize, in_pCompressedTextureFile->GetData() );

    I've attached 2 images. The first is the tga ( with alpha channel ), the compressed file and the difference file; all in The Compressonator. The second is the result in my OpenGL program.

    Any help would be nice
    Thankyou.

  2. #2
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,574

    Re: Texture Compression

    This is not white, it is semi-garbage.
    Have you checked for GL errors after each GL call ?
    http://www.opengl.org/wiki/GL_Error_Codes

  3. #3
    Junior Member Newbie
    Join Date
    Dec 2009
    Posts
    12

    Re: Texture Compression

    Yes, glGetError() returns GL_NO_ERROR.

  4. #4
    Senior Member OpenGL Lord
    Join Date
    Mar 2015
    Posts
    6,676

    Re: Texture Compression

    Are you sure it's actually DXT3 compressed?

  5. #5
    Junior Member Newbie
    Join Date
    Dec 2009
    Posts
    12

    Re: Texture Compression

    The dds file header says it is.

  6. #6
    Junior Member Newbie
    Join Date
    Dec 2009
    Posts
    12

    Re: Texture Compression

    Do I have to do anything speacial on the shader side ? or is it just like normal texture mapping in glsl ?

  7. #7
    Junior Member Newbie
    Join Date
    Dec 2009
    Posts
    12

    Re: Texture Compression



    I missed the second reserved field in the dds header ! There was an offset of 1 byte in the data :s.

    Thanks for the pointers.

Similar Threads

  1. Texture Compression
    By Aeluned in forum OpenGL: Advanced Coding
    Replies: 26
    Last Post: 02-11-2010, 01:21 PM
  2. 3D Texture Compression (not 2D)
    By Jon Mc Jon in forum OpenGL: Advanced Coding
    Replies: 16
    Last Post: 04-25-2008, 11:01 PM
  3. texture compression
    By zed in forum OpenGL: Advanced Coding
    Replies: 7
    Last Post: 09-23-2006, 07:42 PM
  4. Texture compression
    By imported_dimensionX in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 09-15-2006, 02:34 PM
  5. 3d Texture Compression
    By gkhand1 in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 06-12-2005, 05:59 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean