diff options
author | Max Horn | 2003-06-19 16:33:46 +0000 |
---|---|---|
committer | Max Horn | 2003-06-19 16:33:46 +0000 |
commit | 7403492aeafcd601609036f1037c2a352209cdc5 (patch) | |
tree | b8a46482c66627d4c0c8f16ecb98db923e15f17f /backends/sdl | |
parent | ed43323597f6d2b7896033e9cece5a0e87f3f30e (diff) | |
download | scummvm-rg350-7403492aeafcd601609036f1037c2a352209cdc5.tar.gz scummvm-rg350-7403492aeafcd601609036f1037c2a352209cdc5.tar.bz2 scummvm-rg350-7403492aeafcd601609036f1037c2a352209cdc5.zip |
fixed non-bilinear mode (no black line in that anymore; fixing the bilinear case will be challenging, at the least...); some cleanup
svn-id: r8561
Diffstat (limited to 'backends/sdl')
-rw-r--r-- | backends/sdl/fb2opengl.h | 56 | ||||
-rw-r--r-- | backends/sdl/sdl_gl.cpp | 28 |
2 files changed, 32 insertions, 52 deletions
diff --git a/backends/sdl/fb2opengl.h b/backends/sdl/fb2opengl.h index 87f83b6f64..c8da0f13e4 100644 --- a/backends/sdl/fb2opengl.h +++ b/backends/sdl/fb2opengl.h @@ -88,8 +88,22 @@ class FB2GL { void setPalette(int first, int ncolors); void blit16(SDL_Surface *fb, int num_rect, SDL_Rect *rectlist, int xskip, int yskip); void display(); + void setBilinearMode(bool bilinear); }; +void FB2GL::setBilinearMode(bool bilinear) { + GLuint mode = bilinear ? GL_LINEAR : GL_NEAREST; + glBindTexture(GL_TEXTURE_2D, texture1); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, mode); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, mode); + + if (flags & FB2GL_320) { + glBindTexture(GL_TEXTURE_2D, texture2); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, mode); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, mode); + } +} + void FB2GL::makeTextures() { glGenTextures(0,&texture1); glBindTexture(GL_TEXTURE_2D,texture1); @@ -142,8 +156,13 @@ void FB2GL::makeDisplayList(int xf, int yf) { double xfix = (double)xf / 128; // 128 = 256/2 (half texture => 0.0 to 1.0) double yfix = (double)yf / 128; // End of 256x256 (from -1.0 to 1.0) - double texend = (double)96 / 160; // 160=320/2 (== 0.0), 256-160=96. + double texend; + if (flags & FB2GL_320) + texend = 96.0 / 160.0; // 160=320/2 (== 0.0), 256-160=96. + else + texend = 1.0; + if (glIsList(displayList)) glDeleteLists(displayList, 1); @@ -154,31 +173,18 @@ void FB2GL::makeDisplayList(int xf, int yf) { glBindTexture(GL_TEXTURE_2D, texture1); - if (!(flags & FB2GL_320)) { // Normal 256x256 - glBegin(GL_QUADS); - // upper left - glTexCoord2f(0.0, 1.0); glVertex2f(-1.0, -1.0 - yfix); - // lower left - glTexCoord2f(0.0, 0.0); glVertex2f(-1.0, 1.0); - // lower right - glTexCoord2f(1.0, 0.0); glVertex2f(1.0 + xfix, 1.0); - // upper right - glTexCoord2f(1.0, 1.0); glVertex2f(1.0 + xfix, -1.0 - yfix); glEnd(); - } - else { // 320x256 - - // First, the 256x256 texture - glBegin(GL_QUADS); - // upper left - glTexCoord2f(0.0, 1.0); glVertex2f( -1.0, -1.0 - yfix); - // lower left - glTexCoord2f(0.0, 0.0); glVertex2f(-1.0, 1.0); - // lower right - glTexCoord2f(1.0, 0.0); glVertex2f(texend + xfix, 1.0); - // upper right - glTexCoord2f(1.0, 1.0); glVertex2f(texend + xfix, -1.0 - yfix); - glEnd(); + glBegin(GL_QUADS); + // upper left + glTexCoord2f(0.0, 1.0); glVertex2f(-1.0, -1.0 - yfix); + // lower left + glTexCoord2f(0.0, 0.0); glVertex2f(-1.0, 1.0); + // lower right + glTexCoord2f(1.0, 0.0); glVertex2f(texend + xfix, 1.0); + // upper right + glTexCoord2f(1.0, 1.0); glVertex2f(texend + xfix, -1.0 - yfix); + glEnd(); + if (flags & FB2GL_320) { // 64x256 glBindTexture(GL_TEXTURE_2D, texture2); diff --git a/backends/sdl/sdl_gl.cpp b/backends/sdl/sdl_gl.cpp index 46b3634c82..d9df75aace 100644 --- a/backends/sdl/sdl_gl.cpp +++ b/backends/sdl/sdl_gl.cpp @@ -519,7 +519,6 @@ bool OSystem_SDL_OpenGL::poll_event(Event *event) { */ uint32 OSystem_SDL_OpenGL::property(int param, Property *value) { - int i; if (param == PROP_TOGGLE_FULLSCREEN) { if (!_usingOpenGL) @@ -561,32 +560,7 @@ uint32 OSystem_SDL_OpenGL::property(int param, Property *value) { switch(value->gfx_mode) { case GFX_BILINEAR: // Bilinear Filtering (on/off) _glBilinearFilter ^= true; - for (i = 0; i < 2; i++) { - glBindTexture(GL_TEXTURE_2D, i); - if (_glBilinearFilter) { - 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 - ); - } - } + fb2gl.setBilinearMode(_glBilinearFilter); break; case GFX_ASPECTRATIO: _glAspectRatio ^= true; |