feat: add gl EXT handing for mipmap
- comes from gl1.4 - new defines - expand glTexEnvi
This commit is contained in:
parent
83b61f3cfa
commit
11a8736198
37
GL/texture.c
37
GL/texture.c
|
@ -402,15 +402,10 @@ void APIENTRY glBindTexture(GLenum target, GLuint texture) {
|
||||||
void APIENTRY glTexEnvi(GLenum target, GLenum pname, GLint param) {
|
void APIENTRY glTexEnvi(GLenum target, GLenum pname, GLint param) {
|
||||||
TRACE();
|
TRACE();
|
||||||
|
|
||||||
GLint target_values [] = {GL_TEXTURE_ENV, 0};
|
|
||||||
GLint pname_values [] = {GL_TEXTURE_ENV_MODE, 0};
|
|
||||||
GLint param_values [] = {GL_MODULATE, GL_DECAL, GL_REPLACE, 0};
|
|
||||||
|
|
||||||
GLubyte failures = 0;
|
GLubyte failures = 0;
|
||||||
|
|
||||||
|
GLint target_values [] = {GL_TEXTURE_ENV, GL_TEXTURE_FILTER_CONTROL_EXT, 0};
|
||||||
failures += _glCheckValidEnum(target, target_values, __func__);
|
failures += _glCheckValidEnum(target, target_values, __func__);
|
||||||
failures += _glCheckValidEnum(pname, pname_values, __func__);
|
|
||||||
failures += _glCheckValidEnum(param, param_values, __func__);
|
|
||||||
|
|
||||||
TextureObject* active = TEXTURE_UNITS[ACTIVE_TEXTURE];
|
TextureObject* active = TEXTURE_UNITS[ACTIVE_TEXTURE];
|
||||||
|
|
||||||
|
@ -418,6 +413,17 @@ void APIENTRY glTexEnvi(GLenum target, GLenum pname, GLint param) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(failures) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
switch(target){
|
||||||
|
case GL_TEXTURE_ENV:
|
||||||
|
{
|
||||||
|
GLint pname_values [] = {GL_TEXTURE_ENV_MODE, 0};
|
||||||
|
GLint param_values [] = {GL_MODULATE, GL_DECAL, GL_REPLACE, 0};
|
||||||
|
failures += _glCheckValidEnum(pname, pname_values, __func__);
|
||||||
|
failures += _glCheckValidEnum(param, param_values, __func__);
|
||||||
|
|
||||||
if(failures) {
|
if(failures) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -436,6 +442,24 @@ void APIENTRY glTexEnvi(GLenum target, GLenum pname, GLint param) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GL_TEXTURE_FILTER_CONTROL_EXT:
|
||||||
|
{
|
||||||
|
GLint pname_values [] = {GL_TEXTURE_LOD_BIAS_EXT, 0};
|
||||||
|
failures += _glCheckValidEnum(pname, pname_values, __func__);
|
||||||
|
failures += (param > GL_MAX_TEXTURE_LOD_BIAS_DEFAULT || param < -GL_MAX_TEXTURE_LOD_BIAS_DEFAULT);
|
||||||
|
if(failures) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
active->mipmap_bias = (GL_MAX_TEXTURE_LOD_BIAS_DEFAULT+1)+param; // bring to 1-15 inclusive
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void APIENTRY glCompressedTexImage2DARB(GLenum target,
|
void APIENTRY glCompressedTexImage2DARB(GLenum target,
|
||||||
GLint level,
|
GLint level,
|
||||||
|
@ -916,6 +940,7 @@ void APIENTRY glTexImage2D(GLenum target, GLint level, GLint internalFormat,
|
||||||
active->data = NULL;
|
active->data = NULL;
|
||||||
active->mipmap = 0;
|
active->mipmap = 0;
|
||||||
active->mipmapCount = 0;
|
active->mipmapCount = 0;
|
||||||
|
active->mipmap_bias = GL_KOS_INTERNAL_DEFAULT_MIPMAP_LOD_BIAS; // in the scale of -8 - 8 moved to 1-15, -4 = 4
|
||||||
active->dataStride = 0;
|
active->dataStride = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -190,6 +190,21 @@ GLAPI void APIENTRY glCompressedTexImage2DARB(GLenum target,
|
||||||
#define glGenerateMipmap glGenerateMipmapEXT
|
#define glGenerateMipmap glGenerateMipmapEXT
|
||||||
#define glCompressedTexImage2D glCompressedTexImage2DARB
|
#define glCompressedTexImage2D glCompressedTexImage2DARB
|
||||||
|
|
||||||
|
#ifndef GL_VERSION_1_4
|
||||||
|
#define GL_VERSION_1_4 1
|
||||||
|
#define GL_MAX_TEXTURE_LOD_BIAS 0x84FD
|
||||||
|
#define GL_TEXTURE_LOD_BIAS 0x8501
|
||||||
|
#define GL_MAX_TEXTURE_LOD_BIAS_DEFAULT 7
|
||||||
|
#define GL_KOS_INTERNAL_DEFAULT_MIPMAP_LOD_BIAS -4
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef GL_EXT_texture_lod_bias
|
||||||
|
#define GL_EXT_texture_lod_bias 1
|
||||||
|
#define GL_MAX_TEXTURE_LOD_BIAS_EXT 0x84FD
|
||||||
|
#define GL_TEXTURE_FILTER_CONTROL_EXT 0x8500
|
||||||
|
#define GL_TEXTURE_LOD_BIAS_EXT 0x8501
|
||||||
|
#endif /* GL_EXT_texture_lod_bias */
|
||||||
|
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
|
||||||
#endif /* !__GL_GLEXT_H */
|
#endif /* !__GL_GLEXT_H */
|
||||||
|
|
Loading…
Reference in New Issue
Block a user