Results 1 to 9 of 9

Thread: Shaders: ConstantTable.SetConst dynamicly [SOLVED]

  1. #1
    Legendary Member NecroDOME's Avatar
    Join Date
    Mar 2004
    Location
    The Netherlands, Eindhoven
    Posts
    1,059

    Shaders: ConstantTable.SetConst dynamicly [SOLVED]

    System: Windows XP
    Compiler: Turbo Delphi
    Api: DirectX 9


    Hi there,

    I still working on shaders, but progress is very slooooow...

    so here is my question: how do I set my shader constants dynamicly??

    This is what I want to do
    Code:
    ConstantTable.SetMatrix(GetD3DDevice, @ConstName, Matrix)
    When I replace ConstName with a string (eg 'Proj', for projection matrix (doh)) it works (well, it doesn't return a failure ).
    I think its because it wants to have a D3DXHandle, and not a string pointer... so how can I retreive that handle quikly??

    greetz Michiel
    NecroSOFT - End of line -

  2. #2

    Shaders: ConstantTable.SetConst dynamicly [SOLVED]

    Although my knowledge is a bit rusty when working with shaders manually (I'm using effect files instead), I think you can obtain the handle of constant like this:
    Code:
    var
     Handle: TD3DXHandle;
    begin
     Handle:= ConstantTable.GetConstantByName(nil, PChar('MyVariable'));
     ConstantTable.SetMatrix(GetD3DDevice, Handle, Matrix);
    end;

  3. #3
    Legendary Member NecroDOME's Avatar
    Join Date
    Mar 2004
    Location
    The Netherlands, Eindhoven
    Posts
    1,059

    Shaders: ConstantTable.SetConst dynamicly [SOLVED]

    Cool will try when I get home
    NecroSOFT - End of line -

  4. #4
    Legendary Member NecroDOME's Avatar
    Join Date
    Mar 2004
    Location
    The Netherlands, Eindhoven
    Posts
    1,059

    Shaders: ConstantTable.SetConst dynamicly [SOLVED]

    SOLVED!!!

    yeah woohoow... finally shaders support

    thnx Lifepower
    NecroSOFT - End of line -

  5. #5

    Shaders: ConstantTable.SetConst dynamicly [SOLVED]

    What no pics!!! You're banned
    <br /><br />There are a lot of people who are dead while they are still alive. I want to be alive until the day I die.<br />-= Paulo Coelho =-

  6. #6
    Legendary Member NecroDOME's Avatar
    Join Date
    Mar 2004
    Location
    The Netherlands, Eindhoven
    Posts
    1,059

    Shaders: ConstantTable.SetConst dynamicly [SOLVED]

    Yo wanna see a pic?

    not very impressive, but it's renderd with shaders



    No plz unban me
    NecroSOFT - End of line -

  7. #7

    Shaders: ConstantTable.SetConst dynamicly [SOLVED]

    Good work. I had a struggle with HLSL Shaders myself.In fact I'm still trying to get the textures working correctly (they appear corrupted).

    Glad you got it working
    <A HREF="http://www.myhpf.co.uk/banner.asp?friend=139328">
    <br /><IMG SRC="http://www.myhpf.co.uk/banners/60x468.gif" BORDER="0">
    <br /></A>

  8. #8
    Legendary Member NecroDOME's Avatar
    Join Date
    Mar 2004
    Location
    The Netherlands, Eindhoven
    Posts
    1,059

    Shaders: ConstantTable.SetConst dynamicly [SOLVED]

    a bit late, but if you have problems with textures and directx, it could be wrong assignment of the fvf. example:
    fvf := Tex0 and pos would not work, as pos comes before Tex0 (in bit sequence)
    try this for example
    fvf := Pos and Tex0 (also in your shader, had the same problem, once)
    NecroSOFT - End of line -

  9. #9

    Shaders: ConstantTable.SetConst dynamicly [SOLVED]

    That might be the problem in my engine as well.... :think:
    <A HREF="http://www.myhpf.co.uk/banner.asp?friend=139328">
    <br /><IMG SRC="http://www.myhpf.co.uk/banners/60x468.gif" BORDER="0">
    <br /></A>

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •