CodeGuru Forums -
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic Newsletters VB Forums Developer.com


Newest CodeGuru.com Articles:

  • Rapid UI Prototyping with Microsoft Expression Blend 3
  • Visual Studio 2010 Delayed
  • Incremental Intellisense Improvements in Visual Studio 2010
  • [Updated] MODBUS Serial RTU + TCP/IP Simulator

  • Search CodeGuru:
     



    Go Back   CodeGuru Forums > Visual C++ & C++ Programming > Graphics Programming
    FAQ Members List Calendar Search Today's Posts Mark Forums Read

    Graphics Programming Discussion graphics programming using C++. Valid topics include OpenGL, DirectX, GDI/GDI+, Aero, and more.

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1    
    Old October 29th, 2009, 02:02 AM
    Feoggou Feoggou is offline
    Member
     
    Join Date: Aug 2006
    Location: Petrosani, Romania
    Posts: 270
    Feoggou is an unknown quantity at this point (<10)
    Unhappy blending & alpha blending in D3D10

    hi!

    I am trying to learn D3D10, but I'm having some problems.
    1. Can you please explain to me what is blending and what is alpha-blending?

    2. I have a background image and some sprites. The sprites are loaded from a file, 32bit BMP, and have transparent areas (which is, alpha). the code I wrote, and didn't work, was:

    Code:
    ID3D10BlendState* pBlendState10 = NULL;
    D3D10_BLEND_DESC StateDesc;
    ZeroMemory(&StateDesc, sizeof(D3D10_BLEND_DESC));
    StateDesc.AlphaToCoverageEnable = FALSE;
    StateDesc.BlendEnable[0] = TRUE;
    StateDesc.SrcBlend = D3D10_BLEND_SRC_ALPHA;
    StateDesc.DestBlend = D3D10_BLEND_INV_SRC_ALPHA;
    StateDesc.BlendOp = D3D10_BLEND_OP_ADD;
    StateDesc.SrcBlendAlpha = D3D10_BLEND_ZERO;
    StateDesc.DestBlendAlpha = D3D10_BLEND_ZERO;
    StateDesc.BlendOpAlpha = D3D10_BLEND_OP_ADD;
    StateDesc.RenderTargetWriteMask[0] = D3D10_COLOR_WRITE_ENABLE_ALL;
    pD3DDevice->CreateBlendState(&StateDesc, &pBlendState10);
    FLOAT NewBlendFactor[4] = {0,0,0,0};
    pD3DDevice->OMSetBlendState(pBlendState10, NewBlendFactor, 0xffffffff);
    Can somebody please tell me why it didn't work, and what it means? I couldn't figure out from SDK documentation how the operation works. if I exchange SrcBlend with DestBlend why does the sprite dissapear, while if it is so it does not? for me Src + Dest = Dest + Src. (operation add). I can't also understand what the BLEND_ZERO, BLEND_ONE, ... are and how they can be used. and how the operations can be used.

    please help.
    Reply With Quote
      #2    
    Old October 31st, 2009, 05:34 AM
    Feoggou Feoggou is offline
    Member
     
    Join Date: Aug 2006
    Location: Petrosani, Romania
    Posts: 270
    Feoggou is an unknown quantity at this point (<10)
    Post Re: blending & alpha blending in D3D10

    ok... I believe that my video adapter does not support 2 separate blendings. but why doesn't the reference drive type support it?
    Reply With Quote
    Reply

    Bookmarks
    Go Back   CodeGuru Forums > Visual C++ & C++ Programming > Graphics Programming


    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 05:01 AM.



    Acceptable Use Policy


    The Network for Technology Professionals

    Search:

    About Internet.com

    Legal Notices, Licensing, Permissions, Privacy Policy.
    Advertise | Newsletters | E-mail Offers


    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.