From c8c7139fc1c09e3a210d0c4802496da8832f3c30 Mon Sep 17 00:00:00 2001 From: bkaradzic Date: Wed, 17 Apr 2013 20:33:44 -0700 Subject: [PATCH] GL: Set max mip level to save memory. --- src/renderer_gl.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/renderer_gl.cpp b/src/renderer_gl.cpp index f1bd563f..984eaa88 100644 --- a/src/renderer_gl.cpp +++ b/src/renderer_gl.cpp @@ -1205,6 +1205,7 @@ namespace bgfx BX_CHECK(0 != m_id, "Failed to generate texture id."); GL_CHECK(glBindTexture(_target, m_id) ); + GL_CHECK(glTexParameteri(_target, GL_TEXTURE_MAX_LEVEL, _numMips-1) ); GL_CHECK(glTexParameteri(_target, GL_TEXTURE_WRAP_S, s_textureAddress[(_flags&BGFX_TEXTURE_U_MASK)>>BGFX_TEXTURE_U_SHIFT]) ); GL_CHECK(glTexParameteri(_target, GL_TEXTURE_WRAP_T, s_textureAddress[(_flags&BGFX_TEXTURE_V_MASK)>>BGFX_TEXTURE_V_SHIFT]) ); @@ -1511,6 +1512,7 @@ namespace bgfx BX_CHECK(0 != m_id, "Failed to generate texture id."); GL_CHECK(glBindTexture(m_target, m_id) ); + GL_CHECK(glTexParameteri(m_target, GL_TEXTURE_MAX_LEVEL, 0) ); GL_CHECK(glTexParameteri(m_target, GL_TEXTURE_MIN_FILTER, _min) ); GL_CHECK(glTexParameteri(m_target, GL_TEXTURE_MAG_FILTER, _mag) ); GL_CHECK(glTexParameteri(m_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE) ); @@ -1537,6 +1539,7 @@ namespace bgfx GL_CHECK(glGenTextures(1, &m_id) ); BX_CHECK(0 != m_id, "Failed to generate texture id."); GL_CHECK(glBindTexture(m_target, m_id) ); + GL_CHECK(glTexParameteri(m_target, GL_TEXTURE_MAX_LEVEL, 0) ); // GL_CHECK(glTexParameteri(m_target, GL_TEXTURE_COMPARE_MODE, GL_NONE) ); // GL_CHECK(glTexParameteri(m_target, GL_DEPTH_TEXTURE_MODE, GL_NONE) ); GL_CHECK(glTexParameteri(m_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR) );