Advertisement Jump to content
Sign in to follow this  
godsenddeath

camera not working

This topic is 4103 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

ok i've spent the last couple of days figuring out why i couldn't move my camera, then i realized its because the camera isn't working at all, can anyone see whats wrong?

void render_frame()
{

	d3ddev->Clear(0,NULL,D3DCLEAR_TARGET,D3DCOLOR_XRGB(0,40,100),1.0f,0);
	d3ddev->Clear(0,NULL,D3DCLEAR_ZBUFFER,D3DCOLOR_XRGB(0,40,100),1.0f,0);

	d3ddev->BeginScene();

	d3ddev->SetFVF(CUSTOMFVF);





	//D3DXMATRIX matRotateY;

	static float index = 0.0;
	index += 0.01f;





	D3DXMatrixTranslation(&matTransA,0,0,0);

	d3ddev->SetTransform(D3DTS_WORLD,&matTransA);

		D3DXMatrixRotationY(&matRotateY,index);

d3ddev->SetTransform(D3DTS_WORLD,&matRotateY);


	D3DXMatrixLookAtLH(&matView,
	&D3DXVECTOR3(0.0f,0.0f,350.0f),
	&D3DXVECTOR3(0.0f,0.0f,300.0f), 
	&D3DXVECTOR3(0.0f,1.0f,3.0f));

	d3ddev->SetTransform(D3DTS_VIEW,&matView);


D3DXMatrixPerspectiveFovLH(&matProjection,D3DXToRadian(45),(FLOAT)SCREENW/(FLOAT)SCREENH,10.0f,100.0f);


   

    d3ddev->SetTransform(D3DTS_PROJECTION, &matProjection);    // set the projection

	


	d3ddev->SetStreamSource(0,t_buffer,0,sizeof(CUSTOMVERTEX));

	d3ddev->SetTexture(0,text1);


	d3ddev->DrawPrimitive(D3DPT_TRIANGLESTRIP,0,2);
	d3ddev->DrawPrimitive(D3DPT_TRIANGLESTRIP,4,2);
	d3ddev->DrawPrimitive(D3DPT_TRIANGLESTRIP,8,2);
	d3ddev->DrawPrimitive(D3DPT_TRIANGLESTRIP,12,2);
	d3ddev->DrawPrimitive(D3DPT_TRIANGLESTRIP,16,2);
	d3ddev->DrawPrimitive(D3DPT_TRIANGLESTRIP,20,2);
	d3ddev->DrawPrimitive(D3DPT_TRIANGLESTRIP,24,2);





//}


	//meshTea->DrawSubset(0);

	d3ddev->EndScene();

	d3ddev->Present(NULL,NULL,NULL,NULL);



	return;
}






Share this post


Link to post
Share on other sites
Advertisement
Quote:


D3DXMatrixLookAtLH(&matView,
&D3DXVECTOR3(0.0f,0.0f,350.0f),
&D3DXVECTOR3(0.0f,0.0f,300.0f),
&D3DXVECTOR3(0.0f,1.0f,3.0f));


if you want to move your camaera, I think that you must define some variables to store 'eye_pos', 'look_at' and 'up', you can not use constant to move your camera. furthermore, are you sure the parameter you provided to D3DXMatrixLookAtLH is right?

Share this post


Link to post
Share on other sites
wll i'm not concerned about moving the camera around to multiple positions, i just want to set it up, but all that code doesn't effect the camera at all

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!