It is currently Mon Apr 24, 2017 2:07 pm

All times are UTC - 5 hours




 Page 1 of 1 [ 3 posts ] 
Author Message
 Post subject: Everything turn white when moving.
PostPosted: Wed Dec 28, 2011 3:09 am 

Joined: Thu Sep 27, 2007 5:51 pm
Posts: 48
Hello!

So, I'm going through the game engine DVD from the beginning again, so I really understand the Win32 functions. I also did this a month or 2 ago, but then the keyboard/mouse movement worked.
Now I cant use WASD to move, because then everything goes white. This is right after VMK 10 mouse control. Before I added mouse control I could move with the WASD keys, until I turned with q or e.
I can't find any faults in the Camera class, renderPre funtion, or the frame function.


Offline
 Profile  
 
 Post subject: Re: Everything turn white when moving.
PostPosted: Wed Dec 28, 2011 6:40 am 
Site Admin

Joined: Sun Feb 11, 2007 8:59 am
Posts: 1094
Location: Ontario Canada
It sounds to me like there is a typo in your model view matrix causing the view to rotate or jump to an location that is far away from your scene.

To confirm you could could break your program execution right after you start seeing "white" and have a look at your matrix values. An alternative approach is to set up a break point right in the code that you know causes your display to go white and just step through it watching to see when something goes wrong.


Offline
 Profile  
 
 Post subject: Re: Everything turn white when moving.
PostPosted: Wed Dec 28, 2011 3:48 pm 

Joined: Thu Sep 27, 2007 5:51 pm
Posts: 48
I have compared it with my old engine that works, and the only error I found was in setPerpendicularXZ in the Vector3 class, that didn't solve my problem though. Neither could I find any significant differences in the Camera class nor the GameOGL class.

Edit:
So I found it by copy/pasting parts of my old code into the new. It is the Camera constructor.

// old camera
Camera::Camera()
{
   m_v3Position = Vector3(0, 0, 0);
   m_fRX = 0.0f;
   m_fRY = 0.0f;

   m_fLinearSpeed = 5.0f;
   m_fAngularSpeed = 2.0f;

   m_v3LookDirection = Vector3(0, 0, -1.0f);
   m_v3LookDirectionHome = m_v3LookDirection;
   
   m_v3SideDirection.setPerpendicularXZ(m_v3LookDirection);
}

// new camera
Camera::Camera() :
m_v3Position(Vector3(0.0f, 0.0f, 0.0f)),
m_fRY(0.0f),
m_fRX(0.0f),
m_fLinearSpeed(5.0f),
m_fAngularSpeed(2.0f),
m_v3LookDirection(Vector3(0.0f, 0.0f, -1.0f)),
m_v3LookDirectionHome(m_v3LookDirection)
{
   m_v3SideDirection.setPerpendicularXZ(m_v3LookDirection);
}


The // new camera is the one that won't work properly, but I don't understand why.
Is it because of the initialization list perhaps? Or should I just go get a pair of glasses right away?


Offline
 Profile  
 
Display posts from previous:  Sort by  
 Page 1 of 1 [ 3 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Jump to:  

cron