Here is you code all fixed up and working, from a point of view of casting shadows properly lol... make sure the stencilshadow.fx is in the folder...
I modified it to make smaller objects, yours were a little too large, shadows dont like really large flat polygon faces, they tend to make unnatural looking shadows, best to keep things as small a scale as you can...I also added a moving light, you cant have shadows if you dont have a light to cast them
In DarkGDK, Light 0 is the only shadow casting light(although I think dbpro has a command to change this im not sure, ive never had any luck casting hardware stencil shadows from anything other than light 0 in GDK) You can emulate multiple shadow casting lights though by setting up some simple render targets and moving the light to different postions between render target fastsyncs and the final scene render, that way it looks like you have more than one light casting a shadow... I have a cool demo of GDK primitives casting 3 shadows each and moving around here somewhere, if you are interested let me know and ill dig it out.
#include "DarkGDK.h"
void DarkGDK ( void )
{
dbSetDisplayMode(1280,800,32);
dbSetWindowPosition(0,0);
dbSyncOn ( );
dbSyncRate ( 60 );
dbSetGlobalShadowsOn();
dbAutoCamOff();
// set min camera range to 10 .... nothing is happening closer to the cam than this at least...
dbSetCameraRange(10,50000);
dbPositionCamera(50,150,50);
dbXRotateCamera(35);
// WATCH THE OVERLAP SHADOWS TO SEE THE EFFECT THIS COMMAND HAS - MORE SHADES = MORE DEPTH LAYERS FOR OVERLAPS
// A good setting is 3 if your system can handle it, use less to boost performance
dbSetGlobalShadowShades(3); // 3 distinct shades of shadow for when things over lap and for depth.
// lowered the scale of you objects, too large and you need to compensate with various methods
dbMakeObjectPlane(1,5000,5000);
dbPositionObject(1,0,0,0);
dbXRotateObject(1,90);
dbColorObject(1, dbRGB(75, 185, 25));
dbSetShadowShadingOn(1,-1,150,1); // turn on shadow shading, use hardware shader
dbSetShadowClipping(1, 1, 149); // set clipping value to be one less than max range... i find this gives best results, but you need to experiment depending on your cam angles etc
dbRandomize(dbTimer());
for(int i = 0; i < 50; i++)
{
dbMakeObjectBox(10 + i,10,10,10);
dbPositionObject(10 + i, dbRnd(500), 0, dbRnd(500));
dbColorObject(10 + i, dbRGB(100 + dbRnd(155), 100 + dbRnd(155), 100 + dbRnd(155)));
dbSetShadowShadingOn(10 + i, -1, 150, 1);
dbSetShadowClipping(10 + i, 1, 149);
}
// IMPORTANT - light 0 is the shadow casting light.... at the moment, its the
// only shadow casting light that you can use with GDK shadow shading.... you
// can setup multiple render targets and move the light to simulate multiple
// shadow casting lights though, I have a demo somewhere doing that ill dig up
// if you want it... just let me know :)
dbSetPointLight(0, 0, 50, 0);
dbPointCamera(0,0,0);
while ( LoopGDK ( ) )
{
// moving the light around in a circularish motion to make the shadows more visible as they move....
dbPositionLight(0, 0 - (dbCos((dbTimer()*2) / 80.0) * 200.0), 50.0, 0 + (dbSin((dbTimer()*2) / 220.0) * 100.0));
// forwards and backwards
if(dbKeyState(17)) { dbKeyState(42) ? dbMoveCamera(5) : dbMoveCamera(2.5); }
if(dbKeyState(31)) { dbKeyState(42) ? dbMoveCamera(-5) : dbMoveCamera(-2.5); }
// mouse move
static float xRotate = 0;
xRotate += dbMouseMoveY()/4;
dbXRotateCamera(xRotate+90);
static float yRotate = 0;
yRotate += dbMouseMoveX()/4;
dbYRotateCamera(yRotate+90);
dbSync ( );
}
return;
}
I have included in a 7k zip file the 6 FX shaders that come with GDK, I know these ones are working as they work for me no worries, if you think there could be a chance yours have become corrupt or modified sometime, try these ones to see if it makes a difference.... its strange that you can get software shadows to work but not hardware, when you have the shader file there.... software shadows are usually the ones that perform badly..
If it ain't broke.... DONT FIX IT !!!