diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-11-20 13:29:10 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-11-20 22:21:59 +0300 |
commit | 6637f4af57cd60008388bfefda1c37376c9d7042 (patch) | |
tree | eb31d1c197c86583e5f2a525ca020de625f32919 /src/mobileopenglgraphics.cpp | |
parent | cadc0f8b6d0bd71f319c3e6576af05dcd0a7533f (diff) | |
download | plus-6637f4af57cd60008388bfefda1c37376c9d7042.tar.gz plus-6637f4af57cd60008388bfefda1c37376c9d7042.tar.bz2 plus-6637f4af57cd60008388bfefda1c37376c9d7042.tar.xz plus-6637f4af57cd60008388bfefda1c37376c9d7042.zip |
Add debug option to show draw calls per frame.
Also fix map draw and text in debug window with mobile OpenGL.
Diffstat (limited to 'src/mobileopenglgraphics.cpp')
-rw-r--r-- | src/mobileopenglgraphics.cpp | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/src/mobileopenglgraphics.cpp b/src/mobileopenglgraphics.cpp index 504df6897..dcfe18a92 100644 --- a/src/mobileopenglgraphics.cpp +++ b/src/mobileopenglgraphics.cpp @@ -41,6 +41,10 @@ #include "debug.h" GLuint MobileOpenGLGraphics::mLastImage = 0; +#ifdef DEBUG_DRAW_CALLS +unsigned int MobileOpenGLGraphics::mDrawCalls = 0; +unsigned int MobileOpenGLGraphics::mLastDrawCalls = 0; +#endif //unsigned int vertexBufSize = 500; @@ -135,6 +139,9 @@ static inline void drawQuad(const Image *image, glVertexPointer(2, GL_SHORT, 0, &vert); glTexCoordPointer(2, GL_FLOAT, 0, &tex); +#ifdef DEBUG_DRAW_CALLS + MobileOpenGLGraphics::mDrawCalls ++; +#endif glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); } } @@ -177,6 +184,9 @@ static inline void drawRescaledQuad(const Image *const image, glVertexPointer(2, GL_SHORT, 0, &vert); glTexCoordPointer(2, GL_FLOAT, 0, &tex); +#ifdef DEBUG_DRAW_CALLS + MobileOpenGLGraphics::mDrawCalls ++; +#endif glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); } } @@ -745,9 +755,11 @@ void MobileOpenGLGraphics::updateScreen() BLOCK_START("Graphics::updateScreen") // glFlush(); // glFinish(); -// setTexturingAndBlending(true); +#ifdef DEBUG_DRAW_CALLS + mLastDrawCalls = mDrawCalls; + mDrawCalls = 0; +#endif SDL_GL_SwapBuffers(); -// mLastImage = 0; // may be need clear? // glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); BLOCK_END("Graphics::updateScreen") @@ -1013,6 +1025,9 @@ void MobileOpenGLGraphics::drawRectangle(const gcn::Rectangle& rect, }; glVertexPointer(2, GL_SHORT, 0, &vert); +#ifdef DEBUG_DRAW_CALLS + mDrawCalls ++; +#endif glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); } else @@ -1026,6 +1041,9 @@ void MobileOpenGLGraphics::drawRectangle(const gcn::Rectangle& rect, }; glVertexPointer(2, GL_SHORT, 0, &vert); +#ifdef DEBUG_DRAW_CALLS + mDrawCalls ++; +#endif glDrawArrays(GL_LINE_LOOP, 0, 4); } BLOCK_END("Graphics::drawRectangle") @@ -1098,6 +1116,9 @@ inline void MobileOpenGLGraphics::drawTriangleArrayfs(int size) glVertexPointer(2, GL_SHORT, 0, mShortVertArray); glTexCoordPointer(2, GL_FLOAT, 0, mFloatTexArray); +#ifdef DEBUG_DRAW_CALLS + mDrawCalls ++; +#endif glDrawArrays(GL_TRIANGLES, 0, size / 2); } @@ -1110,6 +1131,9 @@ inline void MobileOpenGLGraphics::drawTriangleArrayfs(GLshort *const glVertexPointer(2, GL_SHORT, 0, shortVertArray); glTexCoordPointer(2, GL_FLOAT, 0, floatTexArray); +#ifdef DEBUG_DRAW_CALLS + mDrawCalls ++; +#endif glDrawArrays(GL_TRIANGLES, 0, size / 2); } @@ -1117,6 +1141,9 @@ inline void MobileOpenGLGraphics::drawLineArrays(int size) { glVertexPointer(2, GL_SHORT, 0, mShortVertArray); +#ifdef DEBUG_DRAW_CALLS + mDrawCalls ++; +#endif glDrawArrays(GL_LINES, 0, size / 2); } |