PDA

View Full Version : Shaders: ConstantTable.SetConst dynamicly [SOLVED]



NecroDOME
09-05-2007, 10:01 PM
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

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 :P ).
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

LP
10-05-2007, 02:00 AM
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:


var
Handle: TD3DXHandle;
begin
Handle:= ConstantTable.GetConstantByName(nil, PChar('MyVariable'));
ConstantTable.SetMatrix(GetD3DDevice, Handle, Matrix);
end;

NecroDOME
10-05-2007, 08:09 AM
Cool :) will try when I get home :P

NecroDOME
10-05-2007, 05:46 PM
SOLVED!!!

yeah woohoow... finally shaders support :D:D:D

thnx Lifepower

savage
10-05-2007, 06:20 PM
What no pics!!! You're banned :)

NecroDOME
24-05-2007, 02:07 PM
Yo wanna see a pic?

not very impressive, but it's renderd with shaders :P

http://necrodome.homeftp.net/zooi/Shaders.jpg

No plz unban me :P

technomage
24-05-2007, 10:12 PM
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 :D

NecroDOME
07-09-2007, 04:24 PM
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)

technomage
07-09-2007, 04:30 PM
That might be the problem in my engine as well.... :think: