X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fsdlemu_opengl.c;fp=src%2Fsdlemu_opengl.c;h=6b92f1858fa3024442311bb96966cf13d9c135c9;hb=59ca39a29be645918de45bd144865ba6487f4009;hp=2553785fee9efbf6aab165d220c6108a0034aab7;hpb=33d8eb46c17988e9e843391187d390ecd7e6aa86;p=virtualjaguar diff --git a/src/sdlemu_opengl.c b/src/sdlemu_opengl.c index 2553785..6b92f18 100644 --- a/src/sdlemu_opengl.c +++ b/src/sdlemu_opengl.c @@ -22,6 +22,7 @@ static SDL_Surface *texture = 0; static GLuint texid = 0; static GLfloat texcoord[4]; +static unsigned int glFilter; static inline int power_of_two(int input) { @@ -33,16 +34,16 @@ static inline int power_of_two(int input) return value; } -void sdlemu_init_opengl(SDL_Surface * src, int texturetype, int size, int glfilter) +void sdlemu_init_opengl(SDL_Surface * src, int texturetype, float size, int filter) { int w, h; printf("\nOpenGL driver information :\n"); printf("\n"); - printf("Vendor : %s\n", glGetString(GL_VENDOR)); - printf("Renderer : %s\n", glGetString(GL_RENDERER)); - printf("Version : %s\n", glGetString(GL_VERSION)); - printf("OpenGL drawmethod : "); + printf("Vendor: %s\n", glGetString(GL_VENDOR)); + printf("Renderer: %s\n", glGetString(GL_RENDERER)); + printf("Version: %s\n", glGetString(GL_VERSION)); + printf("OpenGL drawmethod: "); switch (texturetype) { @@ -54,6 +55,8 @@ void sdlemu_init_opengl(SDL_Surface * src, int texturetype, int size, int glfilt break; } + glFilter = filter; + // Texture width/height should be power of 2 // So, find the largest power of two that will contain both the width and height w = power_of_two(src->w); @@ -94,15 +97,15 @@ void sdlemu_init_opengl(SDL_Surface * src, int texturetype, int size, int glfilt glGenTextures(1, &texid); glBindTexture(GL_TEXTURE_2D, texid); - if (glfilter) + if (glFilter) { - printf("OpenGL filters : enabled\n"); + printf("OpenGL filters: enabled\n"); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); } else { - printf("OpenGL filters : disabled\n"); + printf("OpenGL filters: disabled\n"); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); } @@ -158,8 +161,9 @@ void sdlemu_close_opengl(void) // Resize the texture // This should honor the glFilter flag that is passed in to the initialization code, // but, at the moment, it doesn't... +// Now it does...! // -void sdlemu_resize_texture(SDL_Surface * src, SDL_Surface * dst) +void sdlemu_resize_texture(SDL_Surface * src, SDL_Surface * dst, int filter) { // Texture width/height should be power of 2 // So, find the largest power of two that will contain both the width and height @@ -204,15 +208,16 @@ void sdlemu_resize_texture(SDL_Surface * src, SDL_Surface * dst) glGenTextures(1, &texid); glBindTexture(GL_TEXTURE_2D, texid); -/* if (glfilter) +// if (glFilter) + if (filter) { - printf("OpenGL filters : enabled\n"); + printf("OpenGL filters: enabled\n"); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); } - else*/ + else { - printf("OpenGL filters : disabled\n"); + printf("OpenGL filters: disabled\n"); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); }