version 1.12 | | version 1.13 |
---|
| | |
} | | } |
| | |
#define GLstrcmptestr(a,b) if (stricmp(a,#b)==0 || stricmp(a,"GL_" #b)==0)return GL_ ## b; | | #define GLstrcmptestr(a,b) if (stricmp(a,#b)==0 || stricmp(a,"GL_" #b)==0)return GL_ ## b; |
int ogl_atotexfilti(char *a){ | | int ogl_atotexfilti(char *a,int min){ |
GLstrcmptestr(a,NEAREST); | | GLstrcmptestr(a,NEAREST); |
GLstrcmptestr(a,LINEAR); | | GLstrcmptestr(a,LINEAR); |
| | if (min){//mipmaps are valid only for the min filter |
GLstrcmptestr(a,NEAREST_MIPMAP_NEAREST); | | GLstrcmptestr(a,NEAREST_MIPMAP_NEAREST); |
GLstrcmptestr(a,NEAREST_MIPMAP_LINEAR); | | GLstrcmptestr(a,NEAREST_MIPMAP_LINEAR); |
GLstrcmptestr(a,LINEAR_MIPMAP_NEAREST); | | GLstrcmptestr(a,LINEAR_MIPMAP_NEAREST); |
GLstrcmptestr(a,LINEAR_MIPMAP_LINEAR); | | GLstrcmptestr(a,LINEAR_MIPMAP_LINEAR); |
return GL_NEAREST; | | } |
| | Error("unknown/invalid texture filter %s\n",a); |
| | // return GL_NEAREST; |
} | | } |
int ogl_testneedmipmaps(int i){ | | int ogl_testneedmipmaps(int i){ |
switch (i){ | | switch (i){ |
| | |
case GL_LINEAR_MIPMAP_LINEAR: | | case GL_LINEAR_MIPMAP_LINEAR: |
return 1; | | return 1; |
} | | } |
return -1; | | Error("unknown texture filter %x\n",i); |
| | // return -1; |
} | | } |
int gr_init(int mode) | | int gr_init(int mode) |
{ | | { |
int retcode,t; | | int retcode,t,glt=0; |
// Only do this function once! | | // Only do this function once! |
if (gr_installed==1) | | if (gr_installed==1) |
return -1; | | return -1; |
| | |
if (FindArg("-fullscreen")) | | if (FindArg("-fullscreen")) |
gr_toggle_fullscreen(); | | gr_toggle_fullscreen(); |
#endif | | #endif |
if ((t=FindArg("-gl_texmagfilt"))){ | | if ((glt=FindArg("-gl_mipmap"))){ |
| | GL_texmagfilt=GL_LINEAR; |
| | GL_texminfilt=GL_LINEAR_MIPMAP_NEAREST; |
| | } |
| | if ((t=FindArg("-gl_simple"))){ |
| | if (t>=glt){//allow overriding of earlier args |
| | glt=t; |
| | GL_texmagfilt=GL_NEAREST; |
| | GL_texminfilt=GL_NEAREST; |
| | } |
| | } |
| | if ((t=FindArg("-gl_texmagfilt")) || (t=FindArg("-gl_texmagfilter"))){ |
// t=atoi(Args[t+1]); | | // t=atoi(Args[t+1]); |
GL_texmagfilt=ogl_atotexfilti(Args[t+1]); | | if (t>=glt)//allow overriding of earlier args |
| | GL_texmagfilt=ogl_atotexfilti(Args[t+1],0); |
} | | } |
if ((t=FindArg("-gl_texminfilt"))){ | | if ((t=FindArg("-gl_texminfilt")) || (t=FindArg("-gl_texminfilter"))){ |
GL_texminfilt=ogl_atotexfilti(Args[t+1]); | | if (t>=glt)//allow overriding of earlier args |
| | GL_texminfilt=ogl_atotexfilti(Args[t+1],1); |
} | | } |
GL_needmipmaps=(ogl_testneedmipmaps(GL_texminfilt) || ogl_testneedmipmaps(GL_texmagfilt)); | | GL_needmipmaps=ogl_testneedmipmaps(GL_texminfilt); |
mprintf((0,"gr_init: texmagfilt:%x texminfilt:%x needmipmaps=%i\n",GL_texmagfilt,GL_texminfilt,GL_needmipmaps)); | | mprintf((0,"gr_init: texmagfilt:%x texminfilt:%x needmipmaps=%i\n",GL_texmagfilt,GL_texminfilt,GL_needmipmaps)); |
| | |
ogl_init();//platform specific initialization | | ogl_init();//platform specific initialization |