Apply patch by nathanm32292394 to better support gpus/drivers that don't support non-power-of-two textures, thanks a lot

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@11447 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria
2012-07-28 00:18:41 +00:00
parent de6cfbdcc1
commit 8d68c2a766
2 changed files with 17 additions and 2 deletions

View File

@@ -50,11 +50,20 @@ void PostProcessing::init(video::IVideoDriver* video_driver)
m_supported = true;
}
//Check which texture dimensions are supported on this hardware
bool nonsquare = video_driver->queryFeature(video::EVDF_TEXTURE_NSQUARE);
bool nonpower = video_driver->queryFeature(video::EVDF_TEXTURE_NPOT);
if (!nonpower) {
fprintf(stdout, "WARNING: Only power of two textures are supported.\n");
}
if (!nonsquare) {
fprintf(stdout, "WARNING: Only square textures are supported.\n");
}
// Initialization
if(m_supported)
{
// Render target
m_render_target = video_driver->addRenderTargetTexture(video_driver->getScreenSize(), "postprocess");
m_render_target = video_driver->addRenderTargetTexture(video_driver->getScreenSize().getOptimalSize(!nonpower, !nonsquare), "postprocess");
if(!m_render_target)
{
fprintf(stderr, "Couldn't create the render target for post-processing, disabling it\n");

View File

@@ -427,9 +427,15 @@ void Track::loadQuadGraph(unsigned int mode_id, const bool reverse)
}
else
{
//Check whether the hardware can do nonsquare or non power-of-two textures
video::IVideoDriver* const video_driver = irr_driver->getVideoDriver();
bool nonpower = video_driver->queryFeature(video::EVDF_TEXTURE_NPOT);
bool nonsquare = video_driver->queryFeature(video::EVDF_TEXTURE_NSQUARE);
//Create the minimap resizing it as necessary.
m_mini_map=
QuadGraph::get()->makeMiniMap(World::getWorld()->getRaceGUI()
->getMiniMapSize(),
->getMiniMapSize().getOptimalSize(!nonpower, !nonsquare),
"minimap::"+m_ident);
}