void Core::StartDrawing(int mode) { lowPushMatrix(); // Calcul du scaling par rapport à l'horizontale ConfigureViewport(); //Parametrage selon le mode d'affichage if(mode == MODE_2D) { lowSetProjectionOrtho(mWindowWidth, mBaseHeight*GetScaleFactor()); // Translation (bandes noires) // TODO : finir gestion des écrans 4/3, 16/10 //lowTranslate(0, -(mWindowHeight - mBaseHeight)*scaleFactor/2.0f); lowScale(GetScaleFactor(), GetScaleFactor()); glDepthMask(GL_TRUE); } else if(mode == MODE_2D_BACKGROUND) { lowSetProjectionOrtho(mWindowWidth, mBaseHeight*GetScaleFactor()); lowScale(GetScaleFactor(), GetScaleFactor()); glDepthMask(GL_TRUE); } else { lowSetProjectionPerspective(mWindowWidth, mBaseHeight*GetScaleFactor()); glDepthMask(GL_TRUE); } }
bool LudoRenderer::Init(const HWND windowHandle, const int width, const int height) { // Here, there should be error checking! m_d3d = Direct3DCreate9(D3D_SDK_VERSION); D3DDISPLAYMODE d3ddm; m_d3d->GetAdapterDisplayMode( 0, &d3ddm ); D3DPRESENT_PARAMETERS d3dpp; ZeroMemory(&d3dpp, sizeof(d3dpp)); d3dpp.Windowed = TRUE; d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; d3dpp.hDeviceWindow = windowHandle; d3dpp.BackBufferFormat = d3ddm.Format; d3dpp.BackBufferCount = 1; d3dpp.EnableAutoDepthStencil = TRUE; d3dpp.AutoDepthStencilFormat = D3DFMT_D24X8; m_d3d->CreateDevice( D3DADAPTER_DEFAULT, // Default adapter D3DDEVTYPE_HAL, // Default type windowHandle, // handle to your window D3DCREATE_SOFTWARE_VERTEXPROCESSING, // Using software vertex processing &d3dpp, // your parameters &m_d3DDev); // Pointer to the created device. ConfigureScene(); // Note, harcoded value... please remove! ConfigureViewport(45.0f, width, height, 0.01f, 100000.0f); LoadDemoTexturesAndMeshes(); return true; }