bool C4LandscapeRenderGL::Init(int32_t iWidth, int32_t iHeight, C4TextureMap *pTexs, C4GroupSet *pGraphics) { Clear(); // Safe info this->iWidth = iWidth; this->iHeight = iHeight; this->pTexs = pTexs; // Allocate landscape textures if (!InitLandscapeTexture()) { LogFatal("[!] Could not initialize landscape texture!"); return false; } // Build texture, er, texture if (!InitMaterialTexture(pTexs)) { LogFatal("[!] Could not initialize landscape textures for rendering!"); return false; } // Load sclaer if (!LoadScaler(pGraphics)) { LogFatal("[!] Could not load scaler!"); return false; } // Load shader if (!LoadShaders(pGraphics)) { LogFatal("[!] Could not initialize landscape shader!"); return false; } if (!InitVBO()) { LogFatal("[!] Could not initialize landscape VBO!"); return false; } return true; }
RenderWindow2D::RenderWindow2D(unsigned int width, unsigned int height, bool fullscreen, const CString& scaler, unsigned int requestedScaleFactor) :scaleFactor(1), unscaledWidth(width), unscaledHeight(height), scalerFunc(nullptr) { LoadScaler(scaler, requestedScaleFactor); scaleFactor = requestedScaleFactor; if (!CreateWindowAndRenderer(width, height)) throw std::runtime_error("couldn't create window"); SetFullscreen(fullscreen); SDL_SetRenderDrawColor(renderer.get(), 0, 0, 0, 255); // black SDL_RenderClear(renderer.get()); SDL_RenderPresent(renderer.get()); }