From c93aa40ac5149e1877a9ce1e4c285aa197cf8ccd Mon Sep 17 00:00:00 2001 From: Bradley Bell Date: Sun, 18 Jan 2015 22:49:22 -0800 Subject: [PATCH] implement gl_texturemode command --- arch/ogl/gr.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/arch/ogl/gr.c b/arch/ogl/gr.c index 769b3fb0..e4cb586d 100644 --- a/arch/ogl/gr.c +++ b/arch/ogl/gr.c @@ -388,6 +388,40 @@ int ogl_testneedmipmaps(int i){ Error("unknown texture filter %x\n",i); // return -1; } + + +void gr_cmd_texturemode(int argc, char **argv) +{ + if (argc < 2) + return; + + if (!stricmp(argv[1], "GL_NEAREST")) { + GL_texminfilt = GL_NEAREST; + GL_texmagfilt = GL_NEAREST; + } else if (!stricmp(argv[1], "GL_LINEAR")) { + GL_texminfilt = GL_LINEAR; + GL_texmagfilt = GL_LINEAR; + } else if (!stricmp(argv[1], "GL_NEAREST_MIPMAP_NEAREST")) { + GL_texminfilt = GL_NEAREST_MIPMAP_NEAREST; + GL_texmagfilt = GL_NEAREST; + } else if (!stricmp(argv[1], "GL_LINEAR_MIPMAP_NEAREST")) { + GL_texminfilt = GL_LINEAR_MIPMAP_NEAREST; + GL_texmagfilt = GL_LINEAR; + } else if (!stricmp(argv[1], "GL_NEAREST_MIPMAP_LINEAR")) { + GL_texminfilt = GL_NEAREST_MIPMAP_LINEAR; + GL_texmagfilt = GL_NEAREST; + } else if (!stricmp(argv[1], "GL_LINEAR_MIPMAP_LINEAR")) { + GL_texminfilt = GL_LINEAR_MIPMAP_LINEAR; + GL_texmagfilt = GL_LINEAR; + } else + return; + + GL_needmipmaps=ogl_testneedmipmaps(GL_texminfilt); + + ogl_smash_texture_list_internal(); +} + + #ifdef OGL_RUNTIME_LOAD #ifdef _WIN32 char *OglLibPath="opengl32.dll"; @@ -515,6 +549,8 @@ int gr_init() grd_curscreen->sc_canvas.cv_font_bg_color = 0; gr_set_current_canvas( &grd_curscreen->sc_canvas ); + cmd_addcommand("gl_texturemode", gr_cmd_texturemode); + gr_installed = 1; atexit(gr_close); -- 2.39.2