Advertisement
Guest User

Untitled

a guest
May 24th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.00 KB | None | 0 0
  1. Index: sdlmain.cpp
  2. ===================================================================
  3. --- sdlmain.cpp (revision 4225)
  4. +++ sdlmain.cpp (working copy)
  5. @@ -720,6 +720,7 @@
  6. // No borders
  7. glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
  8. glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
  9. + GLfloat tex_offset=0.0;
  10. if (!sdl.opengl.bilinear || ( (sdl.clip.h % height) == 0 && (sdl.clip.w % width) == 0) ) {
  11. glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
  12. glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
  13. @@ -726,6 +727,7 @@
  14. } else {
  15. glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
  16. glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
  17. + tex_offset=0.5/(GLfloat)texsize;
  18. }
  19.  
  20. glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, texsize, texsize, 0, GL_BGRA_EXT, GL_UNSIGNED_BYTE, 0);
  21. @@ -742,8 +744,8 @@
  22. glMatrixMode (GL_MODELVIEW);
  23. glLoadIdentity ();
  24.  
  25. - GLfloat tex_width=((GLfloat)(width)/(GLfloat)texsize);
  26. - GLfloat tex_height=((GLfloat)(height)/(GLfloat)texsize);
  27. + GLfloat tex_width=((GLfloat)(width)/(GLfloat)texsize)-tex_offset;
  28. + GLfloat tex_height=((GLfloat)(height)/(GLfloat)texsize)-tex_offset;
  29.  
  30. if (glIsList(sdl.opengl.displaylist)) glDeleteLists(sdl.opengl.displaylist, 1);
  31. sdl.opengl.displaylist = glGenLists(1);
  32. @@ -751,13 +753,13 @@
  33. glBindTexture(GL_TEXTURE_2D, sdl.opengl.texture);
  34. glBegin(GL_QUADS);
  35. // lower left
  36. - glTexCoord2f(0,tex_height); glVertex2f(-1.0f,-1.0f);
  37. + glTexCoord2f(tex_offset,tex_height); glVertex2f(-1.0f,-1.0f);
  38. // lower right
  39. glTexCoord2f(tex_width,tex_height); glVertex2f(1.0f, -1.0f);
  40. // upper right
  41. - glTexCoord2f(tex_width,0); glVertex2f(1.0f, 1.0f);
  42. + glTexCoord2f(tex_width,tex_offset); glVertex2f(1.0f, 1.0f);
  43. // upper left
  44. - glTexCoord2f(0,0); glVertex2f(-1.0f, 1.0f);
  45. + glTexCoord2f(tex_offset,tex_offset); glVertex2f(-1.0f, 1.0f);
  46. glEnd();
  47. glEndList();
  48. sdl.desktop.type=SCREEN_OPENGL;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement