//================================================================================ void ATHEngine::Init() { // Load from config LoadConfig(); // Create the operating system construct for the game if (!CreateViewport()) return; #ifdef _WIN32 // Start the renderer m_pRenderer = ATHRenderer::GetInstance(); m_pRenderer->Initialize(m_hWnd, m_hInstance, m_nScreenWidth, m_nScreenHeight, m_bFullscreen, m_bVsync); m_pRenderer->SetDebugLines(m_bDebugLines); // Setup input management m_pInputManager = ATHInputManager::GetInstance(); m_pInputManager->Init(m_hWnd, m_hInstance, m_nScreenWidth, m_nScreenWidth, m_nScreenWidth / 2, m_nScreenWidth / 2); // Start Audio Manager m_pAudioManager = ATHAudio::GetInstance(); m_pAudioManager->InitXAudio2(); #endif // _WIN32 // Create event manager m_pEventManager = ATHEventManager::GetInstance(); // Setup Object manager m_pObjectManager = new ATHObjectManager(); m_pObjectManager->Init(); // Test init code TestInit(); m_bShutdown = false; }
void RenderTarget::InitFromTexture(ID3D11Texture2D* texture) { CreateViewport(*texture, &m_viewport); // Make this texture usable as a render target: CreateRenderTargetViewFromTexture(texture, &m_render_target_view); // Make this texture usable in a shader: CreateShaderResourceViewFromTexture(texture, &m_shader_resource_view); }
bool Graphics::Initialize() { g_Graphics = this; m_ClearColor = g_White; CreateDeviceAndSwapChain(); CreateViewport(); CreateDefaultShader(); return true; }
//--------------------------------------------------------------- void CGraphicsLayer::InitD3D(int Width,int Height,int bpp) { //HRESULT r=0; m_rcScreenRect.top= m_rcScreenRect.left=0; m_rcScreenRect.right=Width; m_rcScreenRect.bottom=Height; if(CreateDeviceAndSwapChain()){return;} CreateShader(); if(CreateRasterizer()){return;} CreateViewport(); CreateDepthStencilBuffer(); m_pDeviceContext->OMSetRenderTargets(1,&m_pRenderTargetView,m_pDepthStencilView); }
Renderer::Renderer() : m_last_vertex_count( 0 ), m_alpha_threshold( 0.f ), m_depth_clear_strategy( NO_DEPTH ), m_vbo_synced( false ), m_preblend( false ), m_cull( false ) { glGenBuffers( 1, &m_vertex_vbo ); glGenBuffers( 1, &m_color_vbo ); glGenBuffers( 1, &m_texture_vbo ); m_default_viewport = CreateViewport(); // Load our "no texture" pseudo-texture. sf::Image image; image.create( 2, 2, sf::Color::White ); LoadImage( image, sf::Color::White ); }
HRESULT D3D11Object::Initialize( HWND &hWnd, ID3D11UnorderedAccessView** ppResultUAV ) { printf("Initializing DXObject...\n"); HRESULT hr = S_OK; RECT rc; GetClientRect( hWnd, &rc ); UINT width = rc.right - rc.left; UINT height = rc.bottom - rc.top; InitDeviceContext(static_cast<int>(HEIGHT), static_cast<int>(WIDTH), hWnd ); m_pSwapChain->GetBuffer( 0, __uuidof( ID3D11Texture2D ), reinterpret_cast<void**>(&m_pBackBufferTexture) ); CreateBufferTexUAV( m_pBackBufferTexture, ppResultUAV ); m_pDevice->CreateRenderTargetView( m_pBackBufferTexture, NULL, &m_pRenderTargetView ); CreateViewport(width, height); CreateSamplerStates(); return hr; }