D3D SetViewport problem

Started by
0 comments, last by Sirius 23 years, 11 months ago
I'm trying to handle window resizing by just changing the DX objects that need to be changed, instead of shutting down and reinitializing everything. Everything works fine, except that I can't resize the viewport. --- g_Device3D->SetRenderTarget( newBackBuf, NULL ); D3DVIEWPORT2 vpData; vpData.dwSize = sizeof( vpData ); vpData.dwWidth = newX; vpData.dwHeight = newY; vpData.dvClipX = -1.0f; vpData.dvClipWidth = 2.0f; vpData.dvClipY = 1.0f; vpData.dvClipHeight = 2.0f; vpData.dvMinZ = 0.0f; vpData.dvMaxZ = 1.0f; hr = g_Viewport->SetViewport2( &vpData ); if ( FAILED( hr ) ) ReportMessage( DDErrorString( hr ) ); --- I get a DDERR_INVALIDPARAMS error here, but this is an almost exact copy of the code from my InitDirect3D function, which works fine. What's going on? -Sirius Confucius say: Do not disturb sleeping dragon, for you are crunchy and will taste good with ketchup. Edited by - Sirius on 5/10/00 9:26:34 PM
Confucius say: Do not disturb sleeping dragon, for you are crunchyand will taste good with ketchup.
Advertisement
Are you using DirectX 7? It''s way better.

 HRESULT hr; // create a 640x480 viewport D3DVIEWPORT7 vp = { 0, 0,                      640, 480,                      0.0f, 1.0f                   }; hr = d3d_device->SetViewport(&vp); if( FAILED(hr) )    return hr;   

This topic is closed to new replies.

Advertisement