From 058794cd1f1d117d1879cf13e046843c4fc72d06 Mon Sep 17 00:00:00 2001 From: Alex Zolotarev Date: Wed, 18 Jan 2012 11:09:29 +0300 Subject: [PATCH] [opengl] Temporarily added additional debug logs --- yg/base_texture.cpp | 8 ++++++-- yg/framebuffer.cpp | 7 +++++++ yg/indexbuffer.cpp | 1 + yg/renderbuffer.cpp | 7 +++++++ yg/utils.cpp | 13 +++++++++++++ yg/vertexbuffer.cpp | 1 + 6 files changed, 35 insertions(+), 2 deletions(-) diff --git a/yg/base_texture.cpp b/yg/base_texture.cpp index 6515337e80..3ac1b3d2d1 100644 --- a/yg/base_texture.cpp +++ b/yg/base_texture.cpp @@ -13,8 +13,10 @@ namespace yg void BaseTexture::init() const { OGLCHECK(glGenTextures(1, &m_id)); + LOG(LDEBUG, ("glGenTextures", m_id)); OGLCHECK(glBindTexture(GL_TEXTURE_2D, m_id)); + LOG(LDEBUG, ("glBindTexture", m_id)); OGLCHECK(glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT)); OGLCHECK(glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT)); @@ -73,6 +75,7 @@ namespace yg { int id; OGLCHECK(glGetIntegerv(GL_TEXTURE_BINDING_2D, &id)); + LOG(LDEBUG, ("glGetIntegerv", id)); return id; } @@ -81,10 +84,11 @@ namespace yg if (queue) queue->processFn(bind(&BaseTexture::makeCurrent, this, (yg::gl::PacketsQueue*)0)); -#ifndef OMIM_OS_ANDROID if (current() != m_id) -#endif + { OGLCHECK(glBindTexture(GL_TEXTURE_2D, m_id)); + LOG(LDEBUG, ("glBindTexture", m_id)); + } } unsigned BaseTexture::id() const diff --git a/yg/framebuffer.cpp b/yg/framebuffer.cpp index ae6c69a811..ffe3fe5bc1 100644 --- a/yg/framebuffer.cpp +++ b/yg/framebuffer.cpp @@ -19,6 +19,7 @@ namespace yg { int id; OGLCHECK(glGetIntegerv(GL_FRAMEBUFFER_BINDING_MWM, &id)); + LOG(LDEBUG, ("glGetIntegerv", id)); return id; } @@ -27,7 +28,10 @@ namespace yg if (defaultFB) m_id = 0; else + { OGLCHECK(glGenFramebuffersFn(1, &m_id)); + LOG(LDEBUG, ("glGenFramebuffers", m_id)); + } } FrameBuffer::~FrameBuffer() @@ -39,7 +43,10 @@ namespace yg void FrameBuffer::makeCurrent() { if (m_id != current()) + { OGLCHECK(glBindFramebufferFn(GL_FRAMEBUFFER_MWM, m_id)); + LOG(LDEBUG, ("glBindFramebuffer", m_id)); + } if (m_depthBuffer) m_depthBuffer->attachToFrameBuffer(); diff --git a/yg/indexbuffer.cpp b/yg/indexbuffer.cpp index 218ae5db90..370be8f6ea 100644 --- a/yg/indexbuffer.cpp +++ b/yg/indexbuffer.cpp @@ -18,6 +18,7 @@ namespace yg { int id; OGLCHECK(glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING, &id)); + LOG(LDEBUG, ("glGetIntegerv", id)); return id; } diff --git a/yg/renderbuffer.cpp b/yg/renderbuffer.cpp index 2dc70ea41c..23c4d48557 100644 --- a/yg/renderbuffer.cpp +++ b/yg/renderbuffer.cpp @@ -18,6 +18,7 @@ namespace yg { int id; OGLCHECK(glGetIntegerv(GL_RENDERBUFFER_BINDING_MWM, &id)); + LOG(LDEBUG, ("glGetIntegerv", id)); return id; } @@ -27,6 +28,7 @@ namespace yg // if (!m_isDepthBuffer) { OGLCHECK(glGenRenderbuffersFn(1, &m_id)); + LOG(LDEBUG, ("glGenRenderbuffers", m_id)); makeCurrent(); @@ -37,6 +39,8 @@ namespace yg internalFormat, m_width, m_height)); + LOG(LDEBUG, ("glRenderbufferStorage", m_isDepthBuffer ? "GL_DEPTH_COMPONENT16_MWM" : "GL_RGBA8_MWM", + m_width, m_height)); } /* else { @@ -105,7 +109,10 @@ namespace yg void RenderBuffer::makeCurrent() const { if (m_id != current()) + { OGLCHECK(glBindRenderbufferFn(GL_RENDERBUFFER_MWM, m_id)); + LOG(LDEBUG, ("glBindRenderbuffer", m_id)); + } } bool RenderBuffer::isDepthBuffer() const diff --git a/yg/utils.cpp b/yg/utils.cpp index 3c96b3403c..e66a4fe8dd 100644 --- a/yg/utils.cpp +++ b/yg/utils.cpp @@ -14,6 +14,7 @@ namespace yg void setupCoordinates(size_t width, size_t height, bool doSwap /*= true*/) { OGLCHECK(glViewport(0, 0, width, height)); + LOG(LDEBUG, ("glViewport", width, height)); OGLCHECK(glMatrixMode(GL_MODELVIEW)); OGLCHECK(glLoadIdentity()); @@ -23,14 +24,26 @@ namespace yg #ifdef OMIM_GL_ES if (!doSwap) + { OGLCHECK(glOrthof(0, width, 0, height, -yg::maxDepth, yg::maxDepth)); + LOG(LDEBUG, ("glOrthof", 0, width, 0, height, -yg::maxDepth, yg::maxDepth)); + } else + { OGLCHECK(glOrthof(0, width, height, 0, -yg::maxDepth, yg::maxDepth)); + LOG(LDEBUG, ("glOrthof", 0, width, height, 0, -yg::maxDepth, yg::maxDepth)); + } #else if (!doSwap) + { OGLCHECK(glOrtho(0, width, 0, height, -yg::maxDepth, yg::maxDepth)); + LOG(LDEBUG, ("glOrtho", 0, width, 0, height, -yg::maxDepth, yg::maxDepth)); + } else + { OGLCHECK(glOrtho(0, width, height, 0, -yg::maxDepth, yg::maxDepth)); + LOG(LDEBUG, ("glOrtho", 0, width, height, 0, -yg::maxDepth, yg::maxDepth)); + } #endif } } diff --git a/yg/vertexbuffer.cpp b/yg/vertexbuffer.cpp index b9537b8c7b..006744a3c6 100644 --- a/yg/vertexbuffer.cpp +++ b/yg/vertexbuffer.cpp @@ -18,6 +18,7 @@ namespace yg { int id; OGLCHECK(glGetIntegerv(GL_ARRAY_BUFFER_BINDING, &id)); + LOG(LDEBUG, ("glGetIntegerv", id)); return id; }