diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-06-20 17:42:33 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-06-20 21:11:13 +0300 |
commit | 8963c582f2d2f2879b69821337a5c396f9712a06 (patch) | |
tree | 9cc8f89e3116bb09ad3f4a30f7552fad6e83fe57 /src/render | |
parent | 65f5f9343a75a5adabdf840db93106cda71c703f (diff) | |
download | manaplus-8963c582f2d2f2879b69821337a5c396f9712a06.tar.gz manaplus-8963c582f2d2f2879b69821337a5c396f9712a06.tar.bz2 manaplus-8963c582f2d2f2879b69821337a5c396f9712a06.tar.xz manaplus-8963c582f2d2f2879b69821337a5c396f9712a06.zip |
Fix code style.
Diffstat (limited to 'src/render')
-rw-r--r-- | src/render/mgldefines.h | 8 | ||||
-rw-r--r-- | src/render/modernopenglgraphics.cpp | 34 | ||||
-rw-r--r-- | src/render/shaders/shader.cpp | 2 | ||||
-rw-r--r-- | src/render/shaders/shader.h | 8 | ||||
-rw-r--r-- | src/render/shaders/shaderprogram.cpp | 2 | ||||
-rw-r--r-- | src/render/shaders/shaderprogram.h | 6 | ||||
-rw-r--r-- | src/render/shaders/shadersmanager.cpp | 1 | ||||
-rw-r--r-- | src/render/shaders/shadersmanager.h | 6 |
8 files changed, 39 insertions, 28 deletions
diff --git a/src/render/mgldefines.h b/src/render/mgldefines.h index 524d8eca4..109744b91 100644 --- a/src/render/mgldefines.h +++ b/src/render/mgldefines.h @@ -83,6 +83,14 @@ #define GL_DYNAMIC_DRAW 0x88E8 #endif +#ifndef GL_COMPILE_STATUS +#define GL_FRAGMENT_SHADER 0x8B30 +#define GL_VERTEX_SHADER 0x8B31 +#define GL_COMPILE_STATUS 0x8B81 +#define GL_LINK_STATUS 0x8B82 +#define GL_INFO_LOG_LENGTH 0x8B84 +#endif + #endif // USE_OPENGL #endif // RENDER_MGLDEFINES_H diff --git a/src/render/modernopenglgraphics.cpp b/src/render/modernopenglgraphics.cpp index 96ce5e1ef..ce7f86f56 100644 --- a/src/render/modernopenglgraphics.cpp +++ b/src/render/modernopenglgraphics.cpp @@ -154,10 +154,10 @@ void ModernOpenGLGraphics::postInit() mglGenVertexArrays(1, &mVao); mglBindVertexArray(mVao); mglGenBuffers(1, &mVbo); - //logger->log("gen vbo buffer: %u", mVbo); +// logger->log("gen vbo buffer: %u", mVbo); bindArrayBuffer(mVbo); mglGenBuffers(1, &mEbo); - //logger->log("gen ebo buffer: %u", mEbo); +// logger->log("gen ebo buffer: %u", mEbo); bindElementBuffer(mEbo); logger->log("Compiling shaders"); @@ -274,7 +274,7 @@ void ModernOpenGLGraphics::drawQuad(const Image *const image A_UNUSED, x2, y2, texX2, texY2 }; - //logger->log("allocate: %d, %ld", mVboCached, sizeof(vertices)); +// logger->log("allocate: %d, %ld", mVboCached, sizeof(vertices)); mglBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STREAM_DRAW); #ifdef DEBUG_DRAW_CALLS @@ -303,7 +303,7 @@ void ModernOpenGLGraphics::drawRescaledQuad(const Image *const image A_UNUSED, x2, y2, texX2, texY2 }; - //logger->log("allocate: %d, %ld", mVboCached, sizeof(vertices)); +// logger->log("allocate: %d, %ld", mVboCached, sizeof(vertices)); mglBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STREAM_DRAW); #ifdef DEBUG_DRAW_CALLS @@ -352,8 +352,8 @@ void ModernOpenGLGraphics::testDraw() 800, 600, 800, 600 }; - //logger->log("allocate: %d, %ld", mVboCached, sizeof(vertices)); - //logger->log("allocate ebo: %d, %ld", mEboCached, sizeof(elements)); +// logger->log("allocate: %d, %ld", mVboCached, sizeof(vertices)); +// logger->log("allocate ebo: %d, %ld", mEboCached, sizeof(elements)); mglBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STREAM_DRAW); // mglBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(elements), @@ -572,7 +572,7 @@ inline void ModernOpenGLGraphics::drawVertexes(const #ifdef DEBUG_DRAW_CALLS mDrawCalls ++; #endif - //logger->log("draw from array: %u", *ivbo); +// logger->log("draw from array: %u", *ivbo); glDrawArrays(GL_TRIANGLES, 0, *ivp / 4); } } @@ -946,7 +946,7 @@ void ModernOpenGLGraphics::drawPoint(int x, int y) { x + clipArea.xOffset, y + clipArea.yOffset, 0, 0 }; - //logger->log("allocate: %d, %ld", mVboCached, sizeof(vertices)); +// logger->log("allocate: %d, %ld", mVboCached, sizeof(vertices)); mglBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STREAM_DRAW); #ifdef DEBUG_DRAW_CALLS @@ -965,7 +965,7 @@ void ModernOpenGLGraphics::drawLine(int x1, int y1, int x2, int y2) x1 + clipArea.xOffset, y1 + clipArea.yOffset, 0, 0, x2 + clipArea.xOffset, y2 + clipArea.yOffset, 0, 0 }; - //logger->log("allocate: %d, %ld", mVboCached, sizeof(vertices)); +// logger->log("allocate: %d, %ld", mVboCached, sizeof(vertices)); mglBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STREAM_DRAW); #ifdef DEBUG_DRAW_CALLS @@ -991,7 +991,7 @@ void ModernOpenGLGraphics::drawRectangle(const Rect& rect) x2, y1, 0, 0 }; - //logger->log("allocate: %d, %ld", mVboCached, sizeof(vertices)); +// logger->log("allocate: %d, %ld", mVboCached, sizeof(vertices)); mglBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STREAM_DRAW); #ifdef DEBUG_DRAW_CALLS @@ -1017,7 +1017,7 @@ void ModernOpenGLGraphics::fillRectangle(const Rect& rect) x2, y2, 0, 0 }; - //logger->log("allocate: %d, %ld", mVboCached, sizeof(vertices)); +// logger->log("allocate: %d, %ld", mVboCached, sizeof(vertices)); mglBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STREAM_DRAW); #ifdef DEBUG_DRAW_CALLS @@ -1148,7 +1148,7 @@ void ModernOpenGLGraphics::removeArray(const uint32_t sz, { if (arr[f] == mVboCached) mVboCached = 0; - //logger->log("delete buffers: %u", arr[f]); +// logger->log("delete buffers: %u", arr[f]); } } @@ -1157,7 +1157,7 @@ void ModernOpenGLGraphics::bindArrayBuffer(const GLuint vbo) if (mVboCached != vbo) { mVboCached = vbo; - //logger->log("bind array: %u", vbo); +// logger->log("bind array: %u", vbo); mglBindBuffer(GL_ARRAY_BUFFER, vbo); /* if (mglIsBuffer(vbo) != GL_TRUE) @@ -1280,7 +1280,7 @@ void ModernOpenGLGraphics::finalize(ImageVertexes *const vert) std::vector<GLuint> &vbos = ogl.mVbo; std::vector<GLuint>::const_iterator ivbo; - const int sz = intTexPool.size(); + const int sz = static_cast<int>(intTexPool.size()); vbos.resize(sz); mglGenBuffers(sz, &vbos[0]); /* @@ -1311,7 +1311,7 @@ void ModernOpenGLGraphics::finalize(ImageVertexes *const vert) void ModernOpenGLGraphics::drawTriangleArray(const int size) { - //logger->log("allocate: %d, %ld", mVboCached, size * sizeof(GLint)); +// logger->log("allocate: %d, %ld", mVboCached, size * sizeof(GLint)); mglBufferData(GL_ARRAY_BUFFER, size * sizeof(GLint), mIntArray, GL_STREAM_DRAW); #ifdef DEBUG_DRAW_CALLS @@ -1323,7 +1323,7 @@ void ModernOpenGLGraphics::drawTriangleArray(const int size) void ModernOpenGLGraphics::drawTriangleArray(const GLint *const array, const int size) { - //logger->log("allocate: %d, %ld", mVboCached, size * sizeof(GLint)); +// logger->log("allocate: %d, %ld", mVboCached, size * sizeof(GLint)); mglBufferData(GL_ARRAY_BUFFER, size * sizeof(GLint), array, GL_STREAM_DRAW); #ifdef DEBUG_DRAW_CALLS @@ -1334,7 +1334,7 @@ void ModernOpenGLGraphics::drawTriangleArray(const GLint *const array, void ModernOpenGLGraphics::drawLineArrays(const int size) { - //logger->log("allocate: %d, %ld", mVboCached, size * sizeof(GLint)); +// logger->log("allocate: %d, %ld", mVboCached, size * sizeof(GLint)); mglBufferData(GL_ARRAY_BUFFER, size * sizeof(GLint), mIntArray, GL_STREAM_DRAW); #ifdef DEBUG_DRAW_CALLS diff --git a/src/render/shaders/shader.cpp b/src/render/shaders/shader.cpp index 9a0d317a5..242a9fbdc 100644 --- a/src/render/shaders/shader.cpp +++ b/src/render/shaders/shader.cpp @@ -24,6 +24,8 @@ #include "render/mgl.h" +#include "debug.h" + Shader::Shader(const unsigned int id) : Resource(), mShaderId(id) diff --git a/src/render/shaders/shader.h b/src/render/shaders/shader.h index adcc29702..c5bd2d490 100644 --- a/src/render/shaders/shader.h +++ b/src/render/shaders/shader.h @@ -18,8 +18,8 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef RENDER_SHADER_H -#define RENDER_SHADER_H +#ifndef RENDER_SHADERS_SHADER_H +#define RENDER_SHADERS_SHADER_H #ifdef USE_OPENGL @@ -28,7 +28,7 @@ class Shader final : public Resource { public: - Shader(const unsigned int id); + explicit Shader(const unsigned int id); ~Shader(); @@ -42,4 +42,4 @@ class Shader final : public Resource }; #endif // USE_OPENGL -#endif // RENDER_SHADER_H +#endif // RENDER_SHADERS_SHADER_H diff --git a/src/render/shaders/shaderprogram.cpp b/src/render/shaders/shaderprogram.cpp index 7d79e5cb9..fd2db9ba8 100644 --- a/src/render/shaders/shaderprogram.cpp +++ b/src/render/shaders/shaderprogram.cpp @@ -26,6 +26,8 @@ #include "render/shaders/shader.h" +#include "debug.h" + ShaderProgram::ShaderProgram(const unsigned int id, Shader *const vertex, Shader *const fragment) : diff --git a/src/render/shaders/shaderprogram.h b/src/render/shaders/shaderprogram.h index a0781d684..5289567aa 100644 --- a/src/render/shaders/shaderprogram.h +++ b/src/render/shaders/shaderprogram.h @@ -18,8 +18,8 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef RENDER_SHADERPROGRAM_H -#define RENDER_SHADERPROGRAM_H +#ifndef RENDER_SHADERS_SHADERPROGRAM_H +#define RENDER_SHADERS_SHADERPROGRAM_H #ifdef USE_OPENGL @@ -48,4 +48,4 @@ class ShaderProgram final : public Resource }; #endif // USE_OPENGL -#endif // RENDER_SHADERPROGRAM_H +#endif // RENDER_SHADERS_SHADERPROGRAM_H diff --git a/src/render/shaders/shadersmanager.cpp b/src/render/shaders/shadersmanager.cpp index 2c37f56d5..efaa97c77 100644 --- a/src/render/shaders/shadersmanager.cpp +++ b/src/render/shaders/shadersmanager.cpp @@ -24,7 +24,6 @@ #include "configuration.h" #include "logger.h" -#include "settings.h" #include "render/mgl.h" diff --git a/src/render/shaders/shadersmanager.h b/src/render/shaders/shadersmanager.h index 50e714aba..841f3f072 100644 --- a/src/render/shaders/shadersmanager.h +++ b/src/render/shaders/shadersmanager.h @@ -18,8 +18,8 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef RENDER_SHADERSMANAGER_H -#define RENDER_SHADERSMANAGER_H +#ifndef RENDER_SHADERS_SHADERSMANAGER_H +#define RENDER_SHADERS_SHADERSMANAGER_H #ifdef USE_OPENGL @@ -46,4 +46,4 @@ class ShadersManager final extern ShadersManager shaders; #endif // USE_OPENGL -#endif // RENDER_SHADERSMANAGER_H +#endif // RENDER_SHADERS_SHADERSMANAGER_H |