From 08ea768e168537a72dd73557d63a75b038ffdf92 Mon Sep 17 00:00:00 2001 From: hiker Date: Wed, 6 May 2015 22:33:15 +1000 Subject: [PATCH] Moved create*Sampler functions into TextureRead. --- src/graphics/shaders.cpp | 4 ++-- src/graphics/texture_read.cpp | 10 +++++----- src/graphics/texture_read.hpp | 19 ++++++++++++------- 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/src/graphics/shaders.cpp b/src/graphics/shaders.cpp index ee4e84dcb..309fd6df6 100644 --- a/src/graphics/shaders.cpp +++ b/src/graphics/shaders.cpp @@ -531,7 +531,7 @@ void setTextureSampler(GLenum tp, GLuint texunit, GLuint tid, GLuint sid) } -GLuint XXXcreateNearestSampler() +GLuint createNearestSampler() { #ifdef GL_VERSION_3_3 unsigned id; @@ -631,7 +631,7 @@ void BindTextureSemiTrilinear(GLuint TU, GLuint tex) glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.); } -GLuint XXXcreateTrilinearSampler() +GLuint createTrilinearSampler() { #ifdef GL_VERSION_3_3 unsigned id; diff --git a/src/graphics/texture_read.cpp b/src/graphics/texture_read.cpp index 22d8a8e85..b75e3c17e 100644 --- a/src/graphics/texture_read.cpp +++ b/src/graphics/texture_read.cpp @@ -70,7 +70,7 @@ void TextureReadBaseNew::bindTextureTrilinearAnisotropic(GLuint tex_unit, GLuint } // bindTextureTrilinearAnisotropic // ---------------------------------------------------------------------------- -GLuint createNearestSampler() +GLuint TextureReadBaseNew::createNearestSampler() { #ifdef GL_VERSION_3_3 unsigned id; @@ -98,7 +98,7 @@ void TextureReadBaseNew::bindTextureNearestClamped(GLuint texture_unit, } // bindTextureNearesClamped // ---------------------------------------------------------------------------- -void bindTextureBilinear(GLuint texture_unit, GLuint tex) +void TextureReadBaseNew::bindTextureBilinear(GLuint texture_unit, GLuint tex) { glActiveTexture(GL_TEXTURE0 + texture_unit); glBindTexture(GL_TEXTURE_2D, tex); @@ -110,7 +110,7 @@ void bindTextureBilinear(GLuint texture_unit, GLuint tex) } // bindTextureBilinear // ---------------------------------------------------------------------------- -void bindTextureBilinearClamped(GLuint tex_unit, GLuint tex) +void TextureReadBaseNew::bindTextureBilinearClamped(GLuint tex_unit, GLuint tex) { glActiveTexture(GL_TEXTURE0 + tex_unit); glBindTexture(GL_TEXTURE_2D, tex); @@ -122,7 +122,7 @@ void bindTextureBilinearClamped(GLuint tex_unit, GLuint tex) } // bindTextureBilinearClamped // ---------------------------------------------------------------------------- -void bindTextureSemiTrilinear(GLuint tex_unit, GLuint tex) +void TextureReadBaseNew::bindTextureSemiTrilinear(GLuint tex_unit, GLuint tex) { glActiveTexture(GL_TEXTURE0 + tex_unit); glBindTexture(GL_TEXTURE_2D, tex); @@ -134,7 +134,7 @@ void bindTextureSemiTrilinear(GLuint tex_unit, GLuint tex) } // bindTextureSemiTrilinear // ---------------------------------------------------------------------------- -GLuint createTrilinearSampler() +GLuint TextureReadBaseNew::createTrilinearSampler() { #ifdef GL_VERSION_3_3 unsigned id; diff --git a/src/graphics/texture_read.hpp b/src/graphics/texture_read.hpp index 2d34724fb..508af5ade 100644 --- a/src/graphics/texture_read.hpp +++ b/src/graphics/texture_read.hpp @@ -22,9 +22,6 @@ #include -GLuint createNearestSampler(); -GLuint createTrilinearSampler(); - enum SamplerTypeNew { ST_NEAREST_FILTERED, @@ -46,16 +43,24 @@ public: typedef std::function BindFunction; protected: - static void bindTextureNearest(GLuint TU, GLuint tid); - static void bindTextureNearestClamped(GLuint texture_unit, GLuint tex); - static void bindTextureTrilinearAnisotropic(GLuint, GLuint); + static void bindTextureNearest(GLuint tex_unit, GLuint tex_id); + static void bindTextureBilinear(GLuint texture_unit, GLuint tex); + static void bindTextureBilinearClamped(GLuint tex_unit, GLuint tex); + static void bindTextureNearestClamped(GLuint tex_unit, GLuint tex_id); + static void bindTextureTrilinearAnisotropic(GLuint tex_unit, GLuint tex_id); + static void bindTextureSemiTrilinear(GLuint tex_unit, GLuint tex_id); + GLuint createSamplers(SamplerTypeNew sampler_type); +private: + static GLuint createNearestSampler(); + static GLuint createTrilinearSampler(); + +protected: static BindFunction m_all_bind_functions[2]; std::vector m_bind_functions; static GLuint m_all_texture_types[]; - GLuint createSamplers(SamplerTypeNew); }; // TextureReadBaseNew // ============================================================================