Thread: Transparancy in DirectX8

  1. #1
    Registered User
    Join Date
    Oct 2002
    Posts
    118

    Transparancy in DirectX8

    Hi all,

    I know there is a way to make a color of a texture transparent
    but is there any way to make a color of a surface transparent?

    I have two surfaces one overlaid on the other and I would like the program to have areas of the overlaid surface to be transparent.

    I am using:
    g_hResult = D3DXLoadSurfaceFromFile(g_pBitmapSurface, NULL, NULL, "image.bmp", NULL, D3DX_DEFAULT, 0xFF000000, NULL);

    The second last parameter is the color key, which is usually 0, and I thought changing it from 0 to 0xFF000000 would make the color black of the suface transparent.

    Is there any enabling of transparency or setting up i have to do first?

    Can any one help me, I am new to the Direct3D stuff
    "The distinction between past, present and future is only an illussion, even if a stunning one."
    -Albert Einstein

  2. #2
    Pursuing knowledge confuted's Avatar
    Join Date
    Jun 2002
    Posts
    1,916
    Not sure what you mean - it wasn't clear. Do you want to load the alpha channel from a texture? (.png for example)
    Away.

  3. #3
    Registered User
    Join Date
    Oct 2002
    Posts
    118
    I want to load the alpha channel from a surface, and the file is in BMP format. I am making a 2D tile engine, and need to make the second layer transparent. I am just copying a selected section from a surface to the backbuffer, and was wondering if it could be done without using textures.
    "The distinction between past, present and future is only an illussion, even if a stunning one."
    -Albert Einstein

  4. #4
    Pursuing knowledge confuted's Avatar
    Join Date
    Jun 2002
    Posts
    1,916
    vertex alpha is this what you wanted? You could set all the vertices of the triangles you wanted to be transparent to the same value.
    Away.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. small programming job VC++ Wavs in DirectX8
    By calgonite in forum Projects and Job Recruitment
    Replies: 2
    Last Post: 02-16-2006, 11:52 AM
  2. DirectX8 FVFs
    By Epo in forum Game Programming
    Replies: 16
    Last Post: 10-10-2004, 10:11 AM
  3. DirectX8: Render Only Portions of Screen?
    By Epo in forum Game Programming
    Replies: 2
    Last Post: 12-24-2003, 02:30 PM
  4. BitBlt transparancy question?
    By btq in forum Windows Programming
    Replies: 2
    Last Post: 10-06-2002, 05:46 PM