Hello, this is my first post and I started using Dark GDK yesterday. I'm trying to understand how the shaders work, so I was playing with the "Advanced Shaders" solution from the Tutorials folder. (yes the same example that is explained on the PDF)
I added some code to make the camera move with the mouse and the keyboard.
My question is: why does the screen become blue when I'm not looking at the sphere? when I look at the sphere then everything is fine and the background is black again
it's the same example of the tutorial, I only changed the main loop with this code:
/*
paste the the code found on the advanced shaders included in the
tutorial folder
*/
//begining of my code
// camera variables
float fCameraAngleX = 0.0f;
float fCameraAngleY = 0.0f;
// main program loop
while ( LoopGDK ( ) )
{
// rotate the sphere
dbTurnObjectLeft ( 1, 0.1 );
// move the camera using the arrow keys
dbControlCameraUsingArrowKeys ( 1, 5.0f, 0.3f );
// create a rotation axis based on mouse movement
fCameraAngleX = dbWrapValue ( fCameraAngleX + dbMouseMoveY ( ) * 0.4f );
fCameraAngleY = dbWrapValue ( fCameraAngleY + dbMouseMoveX ( ) * 0.4f );
// rotate camera
dbXRotateCamera ( 1, fCameraAngleX );
dbYRotateCamera ( 1, fCameraAngleY );
// ensure camera 1 is set to same position and rotation as camera 0
dbPositionCamera ( 0, dbCameraPositionX ( 1 ), dbCameraPositionY ( 1 ), dbCameraPositionZ ( 1 ) );
dbRotateCamera ( 0, dbCameraAngleX ( 1 ), dbCameraAngleY ( 1 ), dbCameraAngleZ ( 1 ) );
// hide the quad, show the sphere and draw
// this camera effect to our quad
dbHideObject ( 2 );
dbShowObject ( 1 );
dbSyncCamera ( 1 );
// hide the sphere, show the quad
dbHideObject ( 1 );
dbShowObject ( 2 );
/// update the screen, camera 1 is shown
dbSync ( );
}
//end of my code
as you can see I didn't change the shader code, I just added funtionality to add movement to the camera.
Is this a normal behavior? why does it happen?