• Advertisement


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

Its just above my understanding

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

Well, the same kind of problem in a different look. I just don''t understand, in one program , a piece of code in all its simplicity fails if i copy the same code( not the entire file....i just rewrite the entire thing in another file ) in another program and run it. If you don''t get it, here''s a real life problem i am facing. this code is from a program called RoadMaxII( the game i am working on and the only damn thing giving me hell lot of "Way above my head" problems...)This doesn''t work.It is used to switch from one display resolution to another. It gives me a problem at m_pD3DDevice->Reset( &m_d3dpp ); when i checked the HRESULT value, it gave me some error which meant that one of the method''s parameter values was wrong. the HRESULT value was 0x8876086C which is a D3DERR_INVALIDCALL value. if I just initialised my D3D device with the same parameters at start.It gives no error(which means the parameters are all right ) but , if in the same function i include the reset method, it gives me the same HRESULT. I mean, what the bloody hell is going on? Now, the more mind boggling thing is, this code works perfectly fine in my another program called RoadMax2 which is a predecessor of this roadmax as i decided to have a common interface to do my creation,rendering,setting up of vertices. This decision was made from the previous problem discussed in another post with the subject "Is something wrong" which solved it. But this new bug has crept up and i dont know what to do with it..... HRESULT CD3DEngine::SwitchDisplayMode(DWORD dwWidth, DWORD dwHeight, BOOL bFullScreen) { HRESULT hr; if( !m_bDisplayReady ) return S_OK; if( m_dwScreenWidth==dwWidth && m_dwScreenHeight==dwHeight && m_bFullScreen==bFullScreen ) return S_OK; m_dwScreenWidth = dwWidth; m_dwScreenHeight = dwHeight; m_bDisplayReady = FALSE; if( FAILED( InvalidateDeviceObjects() ) ) { PostQuitMessage(0); return E_FAIL; } if( bFullScreen ) { // Set fullscreen-mode style SetWindowLong( m_hWnd, GWL_STYLE, m_dwWindowStyle | WS_VISIBLE); } else { // Set window-mode style SetWindowLong( m_hWnd, GWL_STYLE, WS_OVERLAPPED | WS_MINIMIZEBOX | WS_SYSMENU | WS_VISIBLE | WS_CAPTION); SetWindowPos( m_hWnd , HWND_TOP , 0 , 0 , m_dwScreenWidth , m_dwScreenHeight , SWP_SHOWWINDOW ); } m_d3dpp.Windowed = bFullScreen; // Window mode (fullscreen). m_d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; // Dealing with animation (see doc). m_d3dpp.BackBufferFormat = m_DesktopMode.Format;// Render to the area of the screen. m_d3dpp.BackBufferCount = 1; // Number of back buffers. m_d3dpp.EnableAutoDepthStencil = TRUE; // Check documentation. m_d3dpp.AutoDepthStencilFormat = D3DFMT_D16; // Check documentation. m_d3dpp.BackBufferWidth = m_dwScreenWidth; m_d3dpp.BackBufferHeight = m_dwScreenHeight; // Reset the device if( SUCCEEDED( hr = m_pD3DDevice->Reset(&m_d3dpp) ) ) { m_bFullScreen = bFullScreen; if( SUCCEEDED( hr = RestoreDeviceObjects() ) ) { m_bDisplayReady = TRUE; return S_OK; } } // If we get here, a fatal error occurred PostMessage( m_hWnd, WM_CLOSE, 0, 0 ); return E_FAIL; }

Share this post

Link to post
Share on other sites

  • Advertisement