User define linear filtering

This commit is contained in:
raven02 2012-12-28 23:23:42 +08:00
parent 3c8d52031e
commit e407ec4314
3 changed files with 15 additions and 3 deletions

View File

@ -60,6 +60,7 @@ void CConfig::Load(const char *iniFileName)
graphics->Get("WindowZoom", &iWindowZoom, 1);
graphics->Get("BufferedRendering", &bBufferedRendering, true);
graphics->Get("HardwareTransform", &bHardwareTransform, false);
graphics->Get("LinearFiltering", &bLinearFiltering, false);
IniFile::Section *sound = iniFile.GetOrCreateSection("Sound");
sound->Get("Enable", &bEnableSound, true);
@ -98,6 +99,7 @@ void CConfig::Save()
graphics->Set("WindowZoom", iWindowZoom);
graphics->Set("BufferedRendering", bBufferedRendering);
graphics->Set("HardwareTransform", bHardwareTransform);
graphics->Set("LinearFiltering", bLinearFiltering);
IniFile::Section *sound = iniFile.GetOrCreateSection("Sound");
sound->Set("Enable", bEnableSound);

View File

@ -52,6 +52,7 @@ public:
bool bHardwareTransform;
bool bBufferedRendering;
bool bDrawWireframe;
bool bLinearFiltering;
int iWindowZoom; // for Windows
// Sound

View File

@ -21,7 +21,7 @@
#include "../ge_constants.h"
#include "../GPUState.h"
#include "TextureCache.h"
#include "../Core/Config.h"
// If a texture hasn't been seen for 200 frames, get rid of it.
#define TEXTURE_KILL_AGE 200
@ -428,8 +428,17 @@ void UpdateSamplingParams()
int tClamp = (gstate.texwrap>>8) & 1;
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, sClamp ? GL_CLAMP_TO_EDGE : GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, tClamp ? GL_CLAMP_TO_EDGE : GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, magFilt ? GL_LINEAR : GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, minFilt ? GL_LINEAR : GL_NEAREST);
// Tested mag/minFilt only work in either one case that can allow GL_LINEAR to be enable
//glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, magFilt ? GL_LINEAR : GL_NEAREST);
//glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, minFilt ? GL_LINEAR : GL_NEAREST);
// User define linear filtering
if ( g_Config.bLinearFiltering ) {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
} else {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
}
}