Results 1 to 2 of 2

Thread: Transparent Texture Map question

  1. #1
    Junior Member Newbie
    Join Date
    Dec 2000
    Ann Arbor, MI, USA

    Transparent Texture Map question

    How do you set the Alpha value for specific colors to be transparent in the texture map?

  2. #2
    Junior Member Newbie
    Join Date
    Sep 2000

    Re: Transparent Texture Map question

    I'm also curious if there is an easy way to do this. As of now I just load the bitmap textures then convert them to 32-bit changing the alpha values based on the the pixel color. Then I create the RGBA texture.

    // convert 24-bit data to 32-bit
    pData = new unsigned char [m_width*m_height*4];
    unsigned int row,col;
    for (row=0;row<m_height;row++)
    for (col=0;col<m_width;col++)
    int index=row*m_width*4+col*4;
    int indexIn=row*m_width*3+col*3;
    if (m_pRGB)
    delete[] m_pRGB;

    // add alpha color mask
    int i;
    int count=m_width*m_height;
    unsigned int* pData=(unsigned int*)m_pRGB;
    for (i=0;i<count;i++)
    if ((pData[i] & 0x00FFFFFF)==color)
    pData[i]= (((alpha << 24) & 0xFF000000)|color);

Similar Threads

  1. Question about rendering transparent texture
    By tri_thinggg in forum OpenGL: Basic Coding
    Replies: 12
    Last Post: 08-03-2017, 12:57 PM
  2. Question about trees (transparent textures)
    By typewriter in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 01-14-2009, 10:54 AM
  3. Question about texture transparent effect
    By CGDeveloper in forum OpenGL: Advanced Coding
    Replies: 3
    Last Post: 06-13-2003, 02:53 AM
  4. Transparent Texture Map question
    By tbalck in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 12-17-2000, 06:02 PM
  5. Question about transparent texture.
    By tttsuhu in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 11-03-2000, 12:06 AM

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