Results 1 to 2 of 2

Thread: how to use glCompressedTexImage2D()

  1. #1
    Junior Member
    Join Date
    Dec 2004
    Posts
    1

    how to use glCompressedTexImage2D()

    Hi.
    Although I want to carry out palette texture use, it does not know how a palette should be specified by glCompressedTexImage2D().
    Would you show me the sample code?
    I need your help well.

    Ralphend

  2. #2
    Junior Member
    Join Date
    Nov 2004
    Location
    Russia
    Posts
    3

    Re: how to use glCompressedTexImage2D()

    This source code shows how to use glCompressedTexImage2D(...) for image file format *.dds that uses DXTC texture compression:

    int LoadTextureDDS( char *filename )
    {
    NVDDSImage *pImage = NULL;
    int w, h;
    int m;
    int level;

    pImage = NVDDSLoad( filename );
    if ( pImage == NULL ) return 0;
    w = pImage->width;
    h = pImage->height;
    level = 0;
    while ( w > 256 || h > 256 )
    {
    level++;
    w = (w == 1) ? w : w >> 1;
    h = (h == 1) ? h : h >> 1;
    }
    for ( m = 0; level < pImage->numMipmaps; level++, m++ )
    {
    glCompressedTexImage2D( GL_TEXTURE_2D, m, pImage->format, w, h, 0, pImage->size[level], pImage->data[level] );
    w = (w == 1) ? w : w >> 1;
    h = (h == 1) ? h : h >> 1;
    }
    NVDDSFree( pImage );

    return 1;
    }
    I hope this sample will help you rosolve your issue.
    If you have any further queries, please do not hesitate to ask me.

Similar Threads

  1. Size of data in glCompressedTexImage2D
    By maximus-dev in forum OpenGL ES 1.X - fixed function hardware
    Replies: 3
    Last Post: 04-28-2010, 06:22 PM
  2. glCompressedTexImage2D
    By bentlegen in forum OpenGL ES general technical discussions
    Replies: 7
    Last Post: 09-02-2004, 08:18 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
  •