Rotating cube cutted on Direct3D9

150 Views Asked by At

I'm trying to show a rotating cube on Direct3D9. I can draw it with success, but during rotation some pixels are not drawn. I'd like to show every part of the cube during rotation. Each face has 0.5f as size and it's rotating with Pitch Yaw Roll from point 0, 0, 0. I tried to disable Z-Buffer or set high Z values of viewport without success. Any advice? Oh, I'm rendering it in wireframe mode. cutted image

EDIT: I confirm that the problem is on Z Buffer. I tried to translate the cube between the Z axis and it's clear that the view is between 0.0 and 1.0, but SetViewport doesn't change it and I don't understand why...

EDIT: The vertices are still cutted also if I disable ZBUFFER. I tried to set a new projection matrix with this implementation (http://pastebin.com/EVCRG6f7) using parameters (m, 90, 800 / 480, -0.1, 100) but the problem persists. cutted image 2

EDIT: I tried with OpenGL the same vertices and view matrix that I used on Direct3D9 and I have my cube correctly draw. I'm initializing it with these values:

                m_pp.BackBufferWidth            = width;
                m_pp.BackBufferHeight           = height;
                m_pp.BackBufferFormat           = D3DFMT_X8R8G8B8;
                m_pp.BackBufferCount            = 0;
                m_pp.MultiSampleType            = D3DMULTISAMPLE_NONE;
                m_pp.MultiSampleQuality         = 0;
                m_pp.SwapEffect                 = D3DSWAPEFFECT_FLIP;
                m_pp.hDeviceWindow              = hWnd;
                m_pp.Windowed                   = !fullscreen;
                m_pp.EnableAutoDepthStencil     = TRUE;
                m_pp.AutoDepthStencilFormat     = D3DFMT_D24S8;
                m_pp.Flags                      = 0;
                m_pp.FullScreen_RefreshRateInHz = (fullscreen) ? 60 : 0;

                p_device->SetRenderState( D3DRS_CULLMODE, D3DCULL_NONE );
                p_device->SetRenderState( D3DRS_FILLMODE, D3DFILL_SOLID );
                p_device->SetRenderState( D3DRS_LIGHTING, FALSE );
                p_device->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE );
                p_device->SetRenderState( D3DRS_ALPHATESTENABLE, FALSE );
                p_device->SetRenderState( D3DRS_SRCBLEND, D3DBLEND_SRCALPHA );
                p_device->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA );
                p_device->SetRenderState( D3DRS_SCISSORTESTENABLE, FALSE );
                p_device->SetRenderState( D3DRS_ZENABLE, TRUE );
0

There are 0 best solutions below