Sorry about an earlier post.. but it seems my posts take a long time to show up.. thanks!
I'm trying to run this simple shader code:
matrix matWorldViewProj : WorldViewProjection;
struct VS_OUTPUT
{
float4 Pos: POSITION;
};
VS_OUTPUT VS( float4 Pos: POSITION )
{
VS_OUTPUT Out = (VS_OUTPUT) 0;
Out.Pos = mul(Pos, matWorldViewProj); // transform Position
return Out;
}
float4 PS() : COLOR
{
float Aintensity = 0.8f;
float4 Acolor = float4(1.0f, 0.075f, 0.075f, 1.0f);
return Aintensity * Acolor;
}
technique TShader
{
pass P0
{
// compiler directives
VertexShader = compile vs_1_1 VS();
PixelShader = compile ps_1_1 PS();
}
}
And here is my Dark Games App code:
#include "DarkSDK.h"
#define INITGUID
#include <dxdiag.h>
#undef INITGUID
#define MAT_WORLD 1
#define MAT_VIEW 2
#define MAT_PROJ 3
#define MAT_WV 4
#define MAT_WVP 5
#define OBJ_SPHERE 1
#define EFFECT_AMBIENT 1
void DarkSDK ( void )
{
// set sync on and sync rate to 60 frames per second
dbSyncOn ( );
dbSyncRate ( 60 );
dbLoadObject("sphere.x", OBJ_SPHERE);
dbLoadEffect("test.fx", EFFECT_AMBIENT, 0);
dbSetObjectEffect(OBJ_SPHERE, EFFECT_AMBIENT);
dbSetEffectTechnique(EFFECT_AMBIENT, "TShader");
// loop until the escape key is pressed
while ( LoopSDK ( ) )
{
if ( dbEscapeKey ( ) )
return;
// update screen
dbSync ( );
}
}
The shader DOES work with DX9 and runs flawless. It just does a simple ambient lighting system. I ported this over to the Dark SDK and now I get an error if I create a world, view, projection matrix, multiply them together and set the constant. It crashes in the setmatrix function. So I learned about the semantic for the DG's worldviewproj and tried that. That's what I'm doing in the code above and I get a stack overflow error. What is going on? I don't understand why it isn't working.
Thanks,
David