Ok, I have a bit of experiance in Visual Basic and imigrated to C++. I read Sams learn C++ in 21 days cover to cover, although I didn't do the examples so I don't remember all of it. Im also dyspraxic and don't have Word installed so I can't run a spell checker. I appologise for any spelling mistakes.
Anyway, my problem. I'm writing a game with OpenGL using GLFW when I execute this code:
int H;
int I;
for (H = 0; H <= 9; H++)
{
for (I = 0; I <= 9; I++)
{
CameraCubeDistance[H] = sqrt(((H*2 + (H+1)*0.25 - 10.375) + CameraX)*
((H*2 + (H+1)*0.25 - 10.375) + CameraX) + ((I*2 + (I+1)*0.25 - 10.375) + CameraZ)*
((I*2 + (I+1)*0.25 - 10.375) + CameraZ) + CameraY*CameraY);
}
}
It stops displaying the textures. It also doesn't work as it should, doubling the value when it gets to [9][2], I worked out why it doesn't work properly with:
cout << &CameraCubeDistance[9][1] << " " << &CameraX << endl;
The memory addresses for each are the same, and I don't have a clue why.
They're both declered globally.
double CameraX;
double CameraY;
double CameraZ;
double CameraCubeDistance[9][9];
I've tried to look it up but can't find anything. I was pretty sure C++ was supposed to do this for you.
Thanks.
-Halty