Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rendergl: Check for GL 4.6 anisotropic TF extension #254

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/engine/rendergl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -562,13 +562,14 @@ void gl_checkextensions()
if(glversion < 300 && dbgexts) conoutf("\frUsing GL_ARB_texture_compression_rgtc extension.");
}

if(hasext("GL_EXT_texture_filter_anisotropic"))
{
if ((glversion >= 460 || hasext("GL_ARB_texture_filter_anisotropic")) ||
hasext("GL_EXT_texture_filter_anisotropic")) {
GLint val;
glGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &val);
glGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY, &val);
hwmaxanisotropy = val;
hasAF = true;
if(dbgexts) conoutf("\frUsing GL_EXT_texture_filter_anisotropic extension.");
if (dbgexts)
conoutf("\frUsing GL_*_texture_filter_anisotropic extension.");
}

if(glversion >= 300 || hasext("GL_EXT_gpu_shader4"))
Expand Down
3 changes: 2 additions & 1 deletion src/engine/texture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,8 @@ void setuptexparameters(int tnum, void *pixels, int clamp, int filter, GLenum fo
glBindTexture(target, tnum);
glTexParameteri(target, GL_TEXTURE_WRAP_S, clamp&1 ? GL_CLAMP_TO_EDGE : (clamp&0x100 ? GL_MIRRORED_REPEAT : GL_REPEAT));
if(target!=GL_TEXTURE_1D) glTexParameteri(target, GL_TEXTURE_WRAP_T, clamp&2 ? GL_CLAMP_TO_EDGE : (clamp&0x200 ? GL_MIRRORED_REPEAT : GL_REPEAT));
if(target==GL_TEXTURE_2D && hasAF && min(anisotropy, hwmaxanisotropy) > 0 && filter > 1) glTexParameteri(target, GL_TEXTURE_MAX_ANISOTROPY_EXT, min(anisotropy, hwmaxanisotropy));
if (target == GL_TEXTURE_2D && hasAF && min(anisotropy, hwmaxanisotropy) > 0 && filter > 1)
glTexParameteri(target, GL_TEXTURE_MAX_ANISOTROPY, min(anisotropy, hwmaxanisotropy));
glTexParameteri(target, GL_TEXTURE_MAG_FILTER, filter && bilinear ? GL_LINEAR : GL_NEAREST);
glTexParameteri(target, GL_TEXTURE_MIN_FILTER,
filter > 1 ?
Expand Down
8 changes: 4 additions & 4 deletions src/shared/glexts.h
Original file line number Diff line number Diff line change
Expand Up @@ -289,10 +289,10 @@ extern PFNGLDRAWBUFFERSPROC glDrawBuffers_;
#define GL_PIXEL_UNPACK_BUFFER 0x88EC
#endif

#ifndef GL_EXT_texture_filter_anisotropic
#define GL_EXT_texture_filter_anisotropic 1
#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF
#ifndef GL_ARB_texture_filter_anisotropic
#define GL_ARB_texture_filter_anisotropic 1
#define GL_TEXTURE_MAX_ANISOTROPY 0x84FE
#define GL_MAX_TEXTURE_MAX_ANISOTROPY 0x84FF
#endif

#ifndef GL_EXT_texture_compression_s3tc
Expand Down