Just to clarify, this example code works ok, it's just the system I'm working from. I get black shaders. Even with dxstudio. Their samples are black on this system.
http://forum.thegamecreators.com/?m=forum_view&t=109874&b=1
Here is a single main.cpp file that reads from the water example by Evolveds ..
#include "DarkGDK.h"
void makeWorld( void );
void makeWater( void );
void updateRefraction( void );
void updateReflection( void );
void makeWorld( void ) {
// dbLoadImage( "DataRocky_cliff_t.bmp", 1 );
// dbMakeObjectBox( 1, 5000, 1, 5000 );
// dbTextureObject( 1, 1 );
// dbPositionObject( 1, 0, -10, 0 );
// dbScaleObjectTexture( 1, 60, 60 );
//dbLoadImage( "Datalead.bmp", 2 );
//dbMakeObjectBox( 2, 20, 80, 5000 );
//dbPositionObject( 2, 2500, 0, 0 );
//dbTextureObject( 2, 2 );
//// SetUVMapping( 2, 256 / 2, 256 /2, 36 );
//dbMakeObjectBox( 3, 20, 80, 5000 );
//dbPositionObject( 3, -2500, 0, 0 );
//dbTextureObject( 3, 2 );
//// SetUVMapping( 3, 256 / 2, 256 / 2, 36 );
//dbMakeObjectBox( 4, 5000, 80, 20 );
//dbPositionObject( 4, 0, 0, 2500 );
//dbTextureObject( 4, 2 );
//// SetUVMapping( 4, 256 / 2, 256 / 2, 36 );
//dbMakeObjectBox( 5, 5000, 80, 20 );
//dbPositionObject( 5, 0, 0, -2500 );
//dbTextureObject( 5, 2 );
//// SetUVMapping( 5, 256 / 2, 256 / 2, 36 );
dbLoadObject( "dataskybox.x", 6 );
dbSetObjectLight( 6, false );
dbScaleObject( 6, 20000, 15000, 20000 );
dbSetObjectTexture( 6, 2, 1 );
dbSetObjectCull( 6, false );
for( int t = 10; t < 260; t++ ) {
dbMakeObjectBox( t, 5 + dbRnd( 80 ), 25 + dbRnd( 150 ), 5 + dbRnd( 80 ) );
dbPositionObject( t, -1000 + dbRnd( 2000 ), dbRnd( 400 ), -1000 + dbRnd( 2000 ) );
dbRotateObject( t, dbRnd( 360 ), dbRnd( 360 ), dbRnd( 360 ) );
dbTextureObject( t, 2 );
// SetUVMapping( t, 256 / 2, 256 / 2, 36 );
}
}
int objNum = 500;
int imgNum = 500;
int fxNum = 500;
float waterHeight = 10.0f;
int waterCamY;
int refract = 1;
int reflect = 1;
void makeWater( void ) {
dbMakeCamera( 30 );
dbSetCameraRange( 30, 1, 15000 );
dbSetCameraAspect( 30, 1.325 );
dbBackdropOff( 30 );
dbSetCameraToImage( 30, imgNum, 512, 512 );
dbSetCameraFOV( 30, 65 );
dbMakeCamera( 31 );
dbSetCameraRange( 31, 1, 15000 );
dbSetCameraAspect( 31, 1.325 );
dbBackdropOff( 31 );
dbSetCameraToImage( 31, imgNum + 1, 512, 512 );
dbSetCameraFOV( 31, 65 );
dbLoadImage( "DataWaves2.dds", imgNum + 2 );
dbLoadObject( "tri_plane.x", objNum );
//dbSetObjectCull( objNum, false );
dbScaleObject( objNum, 10000, 10000, 10000 );
//dbXRotateObject( objNum, -90 );
//dbMakeObjectPlain( objNum, 5000, 5000 );
dbTextureObject( objNum, 0, imgNum + 2 );
dbTextureObject( objNum, 1, imgNum );
dbTextureObject( objNum, 2, imgNum + 1 );
dbLoadEffect( "FXFresnel Water.fx", fxNum, 0 );
dbSetObjectEffect( objNum, fxNum );
//dbXRotateObject( objNum, 270 );
dbSetObjectTransparency( objNum, true );
}
void updateWater( void ) {
dbPositionObject( objNum, dbObjectPositionX( objNum ), waterHeight, dbObjectPositionZ( objNum ) );
waterCamY = dbCameraPositionY( ) - waterHeight;
dbHideObject( objNum );
if( refract == 1 )
updateRefraction( );
if( reflect == 1 )
updateReflection( );
dbShowObject( objNum );
dbSyncMask( 0x3fffffff );
}
void updateRefraction( void ) {
dbPositionCamera( 30, dbCameraPositionX( ), dbCameraPositionY( ), dbCameraPositionZ( ) );
dbRotateCamera( 30, dbCameraAngleX( ), dbCameraAngleY( ), dbCameraAngleZ( ) );
dbSetCameraClip( 30, 1, 0, waterHeight + ( 5 + waterCamY / 25 ), 0, 0, -1, 0 );
dbSetCameraClip( 31, 0, 0, 0, 0, 0, 0, 0 );
dbSyncMask( 0x40000000 );
dbFastSync( );
dbFogOff( );
}
void updateReflection( void ) {
dbPositionCamera( 31, dbCameraPositionX( ), waterHeight - waterCamY, dbCameraPositionZ( ) );
dbRotateCamera( 31, -dbCameraAngleX( ), dbCameraAngleY( ), dbCameraAngleZ( ) );
int clipY = waterCamY;
if( clipY > 100 )
clipY = 100;
dbSetCameraClip( 31, 1, 0, waterHeight - ( 1 + ( clipY / 25 ) ), 0, 0, 1, 0 );
dbSetCameraClip( 30, 0, 0, 0, 0, 0, 0, 0 );
dbSyncMask( 0x80000000 );
dbFastSync( );
}
void DarkGDK( void ) {
dbSyncOn( );
dbSyncRate( 0 );
dbAutoCamOff( );
dbPositionCamera( 0, 250, 0 );
dbSetCameraRange( 1, 100000 );
dbSetCameraFOV( 65 );
dbBackdropOff( );
makeWorld( );
makeWater( );
int cx = 0;
int cy = 0;
int ncr = 0;
int ncf = 0;
int cr = 0;
int cf = 0;
int ncx = 0;
int ncy = 0;
dbSetEffectTechnique( fxNum, "Reflect" );
while( true ) {
if( dbRightKey( ) ) {
cr = -5;
}
if( dbLeftKey( ) ) {
cr = 5;
}
if( dbUpKey( ) ) {
cf = 5;
}
if( dbDownKey( ) ) {
cf = -5;
}
ncr = dbCurveValue( cr, ncr, 5 );
ncf = dbCurveValue( cf, ncf, 5 );
cx += dbMouseMoveY( ) * 0.02f;
cy += dbMouseMoveX( ) * 0.02f;
if( cx > 80 )
cx = 80;
if( cx < -80 )
cx = -80;
ncx = dbCurveAngle( cx, ncx, 2 );
ncy = dbCurveAngle( cy, ncy, 2 );
dbMoveCamera( ncf );
dbRotateCamera( 0, dbWrapValue( ncy - 90 ), 0 );
dbMoveCamera( ncr );
dbRotateCamera( 0, dbWrapValue( ncy + 90 ), 0 );
dbRotateCamera( ncx, ncy, 0 );
dbPositionObject( 6, dbCameraPositionX( ), dbCameraPositionY( ) + 100, dbCameraPositionZ( ) );
if( dbShiftKey( ) )
dbPasteImage( imgNum, 0, 0 );
if( dbControlKey( ) )
dbPasteImage( imgNum + 1, 0, 0 );
if( dbKeyState( 2 ) ) {
dbSetEffectTechnique( fxNum, "FresnelRefractReflect" );
refract = 1;
reflect = 1;
}
if( dbKeyState( 3 ) ) {
dbSetEffectTechnique( fxNum, "RefractReflect" );
refract = 1;
reflect = 1;
}
if( dbKeyState( 4 ) ) {
dbSetEffectTechnique( fxNum, "Reflect" );
refract = 1;
reflect = 1;
}
if( dbKeyState( 5 ) ) {
dbSetEffectTechnique( fxNum, "Refract" );
refract = 1;
reflect = 1;
}
updateWater( );
dbSync( );
}
}