bool DG8Graphics::SetupGraphics(void) { if((m_Direct3D = Direct3DCreate8(D3D_SDK_VERSION)) != NULL){ if(m_Direct3D->GetAdapterDisplayMode(D3DADAPTER_DEFAULT,&m_DisplayMode) == D3D_OK){ // Set up the structure used to create the D3DDevice D3DPRESENT_PARAMETERS d3dpp; memset(&d3dpp,0,sizeof(d3dpp) ); d3dpp.Windowed = TRUE; d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; d3dpp.BackBufferFormat = m_DisplayMode.Format; if(m_Direct3D->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, m_platform->m_hwnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &m_RenderDevice) == D3D_OK){ m_RenderDevice->SetRenderState(D3DRS_ZENABLE,D3DZB_TRUE); m_RenderDevice->SetRenderState(D3DRS_ZFUNC,D3DCMP_LESSEQUAL); Disable(IGraphics::LIGHTING); SetClearColour(0,0,0); return true; } } } return false; }
/** OpenGL Constructor * Enables the Graphics subsystem active and in 3D mode by default */ OGLGraphics::OGLGraphics() { m_active = false; Enable3DMode = true; Enable(IGraphics::POLYGON); SetClearColour(0,0,0); }
DX11::DX11() { m_pSwapChain = NULL; m_pDevice = NULL; m_pDeviceContext = NULL; m_pRenderTargetView = NULL; m_pDepthStencilBuffer = NULL; m_pDepthStencilState = NULL; m_pDepthStencilView = NULL; m_pRasterState = NULL; m_renderScale = 1.0f; m_pBackBuffer = NULL; #if defined(_DEBUG) m_pDebug = NULL; #endif SetClearColour(0.0f, 0.0f, 0.25f, 1.0f); }