Archived

This topic is now archived and is closed to further replies.

Esap1

Any Ideas?

Recommended Posts

Spellbound helped me with this a lot, and I was wondering if anyone could figure out my problem(including you spellbound). Im making a portal engine, and Im trying to be able the change the size of the viewport that is drawn. So to draw behind a portal I could set the viewport to the size of a bounding box around the portal. Well what happens is the screen looks a little smashed down, like someone crunched the screen down(Top and Bottom), and when I move forward, it drifts slightly to the right, any ideas? Here the code: float l1,r1,b1,t1; l1 = 0; t1 = 0; r1 = 480; b1 = 640; memset(&Viewport,0,sizeof(D3DVIEWPORT7)); Viewport.dwX=0; Viewport.dwY=0; Viewport.dwWidth = 480; Viewport.dwHeight = 640; Viewport.dvMinZ = 0; Viewport.dvMaxZ = 1000; m_App->m_pD3DDev->SetViewport(&Viewport); float aspect,fov,n,f,l,r,t,b; n=1.0f; f=3000.0f; fov = 90.0f* (PI/180); aspect = 480.0f/640.0f; l = -n*tan(fov/2) + l1/640.0f * (2*n*tan(fov/2)); r = -n*tan(fov/2) + r1/640.0f * (2*n*tan(fov/2)); t = -aspect*n*tan(fov/2) + t1/480.0f * (2*aspect*n*tan(fov/2)); b = -aspect*n*tan(fov/2) + b1/480.0f * (2*aspect*n*tan(fov/2)); D3DXMatrixPerspectiveOffCenterLH(&matProj, l,r,t,b, n,f); Now If I change that with this: D3DUtil_SetProjectionMatrix( matProj, 1.57f, 640/480, 1.0f, 10000.0f ); It works fine!, Please help, Thanks a lot!

Share this post


Link to post
Share on other sites
I found that mirror example in the DX7 SDK, and it looks very FAST!(which makes me happy), because it setting up four clip planes, and lots of other stuff. Well, Im learnin more about trig, but still have a little trouble with the SetClipPlane() function, could someone show me a quick example, that would be VERY helpful(Im getting exicted about this engine)THANK YOU!

Update: Im using that .RTG file format the guy made on Gamasutra.com in that MAXSCRIPT and writing a function to load it, things are looking good for my little 3d ENGINE

Share this post


Link to post
Share on other sites