Jump to content
  • Advertisement
Sign in to follow this  

onFrameMove and jerky camera

This topic is 2803 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi everybody,

I have a problem, I use DXUT and at times when I move my camera, it's jerky.
I use these callback :
DXUTSetCallbackFrameMove (OnFrameMove, scene);
DXUTSetCallbackD3D11FrameRender (OnFrameRender, scene);

void WINAPI OnFrameMove( double fTime, float fElapsedTime, void* pUserContext ) {
Scene &s = *static_cast<Scene*>(pUserContext);
// if the camera move
s.pCamera.frameMove(fElapsedTime); // update the position
s.pCamera.render(); // compute the matrix
s.pCamera.renderReflection(s.pWaterPlane->getHeight()); // compute the matrix of reflection

//move the water
s.pShaderWater.setWaterMove(s.pShaderWater.getWaterMove() + 0.0001f);
if(s.pShaderWater.getWaterMove() > 1.0f)
s.pShaderWater.setWaterMove(s.pShaderWater.getWaterMove()- 1.0f);

The message callback :
LRESULT CALLBACK WindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam,bool *pbNoFurtherProcessing,void *pUserContext)
Scene &s = *static_cast<Scene*>(pUserContext);
switch( msg ) {
switch(wParam) {
case VK_UP : s.pCamera.setMoveForward(true);break;
case VK_DOWN : s.pCamera.setMoveBackward(true);break;
case VK_LEFT: s.pCamera.setMoveLeft(true);break;
case VK_RIGHT : s.pCamera.setMoveRight(true);break;
case 'A': s.pCamera.setMoveUp(true);break;
case 'Z' : s.pCamera.setMoveDown(true);break;
case WM_KEYUP:{
switch(wParam) {
case VK_UP : s.pCamera.setMoveForward(false);break;
case VK_DOWN : s.pCamera.setMoveBackward(false);break;
case VK_LEFT: s.pCamera.setMoveLeft(false);break;
case VK_RIGHT : s.pCamera.setMoveRight(false);break;
case 'A': s.pCamera.setMoveUp(false);break;
case 'Z' : s.pCamera.setMoveDown(false);break;
return 0;

And the move function :

void Camera::MoveForward(float p_time){
m_position.z+=m_speed * p_time;

and in my function onFrameRender , i draw the differents objects of my scene one by one.

in 7 sec my camera jumps:

An idea of this problem?

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!