Use CLAMP_TO_BORDER with shaders and POT textures.

This commit is contained in:
Brandon Wright 2010-10-28 11:27:07 -05:00
parent 4fe52bd398
commit ab6f76a9a3
2 changed files with 6 additions and 14 deletions

View File

@ -111,7 +111,6 @@ __extension__
void void
S9xOpenGLDisplayDriver::update (int width, int height) S9xOpenGLDisplayDriver::update (int width, int height)
{ {
GLint filter;
uint8 *final_buffer = NULL; uint8 *final_buffer = NULL;
int final_pitch; int final_pitch;
void *pboMemory = NULL; void *pboMemory = NULL;
@ -132,16 +131,12 @@ S9xOpenGLDisplayDriver::update (int width, int height)
resize_window (allocation.width, allocation.height); resize_window (allocation.width, allocation.height);
} }
/* This avoids messing with the texture parameters every time */ GLint filter = config->bilinear_filter ? GL_LINEAR : GL_NEAREST;
if (config->bilinear_filter != filtering) glTexParameteri (tex_target, GL_TEXTURE_MAG_FILTER, filter);
{ glTexParameteri (tex_target, GL_TEXTURE_MIN_FILTER, filter);
filter = config->bilinear_filter ? GL_LINEAR : GL_NEAREST; GLint clamp = (using_shaders || !dyn_resizing) ? GL_CLAMP_TO_BORDER : GL_CLAMP_TO_EDGE;
glTexParameteri (tex_target, GL_TEXTURE_MAG_FILTER, filter); glTexParameteri (tex_target, GL_TEXTURE_WRAP_S, clamp);
glTexParameteri (tex_target, GL_TEXTURE_MIN_FILTER, filter); glTexParameteri (tex_target, GL_TEXTURE_WRAP_T, clamp);
glTexParameteri (tex_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri (tex_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
filtering = config->bilinear_filter;
}
glClear (GL_COLOR_BUFFER_BIT); glClear (GL_COLOR_BUFFER_BIT);
glEnable (tex_target); glEnable (tex_target);
@ -861,8 +856,6 @@ S9xOpenGLDisplayDriver::init (void)
GFX.Screen = (uint16 *) padded_buffer[0]; GFX.Screen = (uint16 *) padded_buffer[0];
GFX.Pitch = image_width * image_bpp; GFX.Pitch = image_width * image_bpp;
filtering = -1;
swap_control (config->sync_to_vblank); swap_control (config->sync_to_vblank);
initialized = 1; initialized = 1;

View File

@ -130,7 +130,6 @@ class S9xOpenGLDisplayDriver : public S9xDisplayDriver
GLuint vertex_shader; GLuint vertex_shader;
int dyn_resizing; int dyn_resizing;
int filtering;
int using_pbos; int using_pbos;
int using_shaders; int using_shaders;
int initialized; int initialized;