[Scummvm-cvs-logs] CVS: scummvm/backends/sdl fb2opengl.h,1.9,1.10 sdl_gl.cpp,1.34,1.35
Max Horn
fingolfin at users.sourceforge.net
Thu Jun 19 09:34:15 CEST 2003
Update of /cvsroot/scummvm/scummvm/backends/sdl
In directory sc8-pr-cvs1:/tmp/cvs-serv8768
Modified Files:
fb2opengl.h sdl_gl.cpp
Log Message:
fixed non-bilinear mode (no black line in that anymore; fixing the bilinear case will be challenging, at the least...); some cleanup
Index: fb2opengl.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/sdl/fb2opengl.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- fb2opengl.h 15 Apr 2003 01:32:16 -0000 1.9
+++ fb2opengl.h 19 Jun 2003 16:33:45 -0000 1.10
@@ -88,8 +88,22 @@
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 @@
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 @@
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);
Index: sdl_gl.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/sdl/sdl_gl.cpp,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- sdl_gl.cpp 19 Jun 2003 16:16:35 -0000 1.34
+++ sdl_gl.cpp 19 Jun 2003 16:33:46 -0000 1.35
@@ -519,7 +519,6 @@
*/
uint32 OSystem_SDL_OpenGL::property(int param, Property *value) {
- int i;
if (param == PROP_TOGGLE_FULLSCREEN) {
if (!_usingOpenGL)
@@ -561,32 +560,7 @@
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;
More information about the Scummvm-git-logs
mailing list