summaryrefslogtreecommitdiff
path: root/src/render
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-09-23 22:01:44 +0300
committerAndrei Karas <akaras@inbox.ru>2016-09-23 22:01:44 +0300
commit3c404128c4669a1f4f190e20a89553677717fc50 (patch)
tree2db4e5031089c800c4e00fd6244e578f44a7c910 /src/render
parent89b267d6d73bbc59f7c313b8a22b97fbb27f99a8 (diff)
downloadplus-3c404128c4669a1f4f190e20a89553677717fc50.tar.gz
plus-3c404128c4669a1f4f190e20a89553677717fc50.tar.bz2
plus-3c404128c4669a1f4f190e20a89553677717fc50.tar.xz
plus-3c404128c4669a1f4f190e20a89553677717fc50.zip
Add missing comments into defines.
Diffstat (limited to 'src/render')
-rw-r--r--src/render/graphics.cpp66
-rw-r--r--src/render/graphics.h27
-rw-r--r--src/render/mobileopengl2graphics.cpp60
-rw-r--r--src/render/mobileopengl2graphics.h6
-rw-r--r--src/render/mobileopenglgraphics.cpp73
-rw-r--r--src/render/mobileopenglgraphics.h9
-rw-r--r--src/render/modernopenglgraphics.cpp56
-rw-r--r--src/render/modernopenglgraphics.h9
-rw-r--r--src/render/normalopenglgraphics.cpp104
-rw-r--r--src/render/normalopenglgraphics.h14
-rw-r--r--src/render/nullopenglgraphics.cpp56
-rw-r--r--src/render/nullopenglgraphics.h11
-rw-r--r--src/render/opengl/mgl.cpp2
-rw-r--r--src/render/opengl/mgldefines.h34
-rw-r--r--src/render/opengl/mglemu.cpp2
-rw-r--r--src/render/opengl/mglfunctions.h4
-rw-r--r--src/render/opengl/mgltypes.h17
-rw-r--r--src/render/opengl/opengldebug.h4
-rw-r--r--src/render/openglx/mglx.cpp2
-rw-r--r--src/render/openglx/mglxinit.cpp2
-rw-r--r--src/render/renderers.cpp10
-rw-r--r--src/render/safeopenglgraphics.cpp5
-rw-r--r--src/render/safeopenglgraphics.h8
-rw-r--r--src/render/sdl2graphics.cpp4
-rw-r--r--src/render/sdl2softwaregraphics.cpp27
-rw-r--r--src/render/sdlgraphics.cpp20
-rw-r--r--src/render/shaders/shaderprogram.cpp2
-rw-r--r--src/render/shaders/shadersmanager.cpp4
-rw-r--r--src/render/surfacegraphics.cpp15
-rw-r--r--src/render/vertexes/imagecollection.cpp4
-rw-r--r--src/render/vertexes/imagecollection.h3
-rw-r--r--src/render/vertexes/imagevertexes.cpp2
-rw-r--r--src/render/vertexes/imagevertexes.h3
-rw-r--r--src/render/vertexes/openglgraphicsvertexes.cpp2
-rw-r--r--src/render/vertexes/openglgraphicsvertexes.h6
35 files changed, 376 insertions, 297 deletions
diff --git a/src/render/graphics.cpp b/src/render/graphics.cpp
index 59524d300..931ac41f7 100644
--- a/src/render/graphics.cpp
+++ b/src/render/graphics.cpp
@@ -68,11 +68,11 @@
#ifdef USE_OPENGL
#include "configuration.h"
#include "graphicsmanager.h"
-#endif
+#endif // USE_OPENGL
#if defined(USE_OPENGL) && defined(USE_X11)
#include "render/openglx/mglxinit.h"
-#endif
+#endif // defined(USE_OPENGL) && defined(USE_X11)
#ifdef USE_OPENGL
#include "resources/openglimagehelper.h"
@@ -102,8 +102,8 @@ RENDER_OPENGL_MGLDEFINES_H
#ifdef USE_OPENGL
#ifndef GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX
#define GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX 0x9049
-#endif
-#endif
+#endif // GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX
+#endif // USE_OPENGL
Graphics *mainGraphics A_NONNULLPOINTER = nullptr;
@@ -116,10 +116,10 @@ Graphics::Graphics() :
mWindow(nullptr),
#ifdef USE_SDL2
mRenderer(nullptr),
-#endif
+#endif // USE_SDL2
#ifdef USE_OPENGL
mGLContext(nullptr),
-#endif
+#endif // USE_OPENGL
mBpp(0),
mAlpha(false),
mFullscreen(false),
@@ -158,8 +158,8 @@ Graphics::~Graphics()
SDL_GL_DeleteContext(mGLContext);
mGLContext = nullptr;
}
-#endif
-#endif
+#endif // USE_OPENGL
+#endif // USE_SDL2
}
void Graphics::setSync(const bool sync) restrict2
@@ -233,7 +233,8 @@ int Graphics::getOpenGLFlags() const restrict2
int displayFlags = SDL_WINDOW_OPENGL;
if (mFullscreen)
displayFlags |= SDL_WINDOW_FULLSCREEN;
-#else
+#else // USE_SDL2
+
int displayFlags = SDL_ANYFORMAT | SDL_OPENGL;
#endif // USE_SDL2
@@ -248,14 +249,15 @@ int Graphics::getOpenGLFlags() const restrict2
#if !defined(_WIN32)
if (mEnableResize)
displayFlags |= SDL_RESIZABLE;
-#endif
+#endif // !defined(_WIN32)
}
if (mNoFrame)
displayFlags |= SDL_NOFRAME;
return displayFlags;
-#else
+#else // USE_OPENGL
+
return 0;
#endif // USE_OPENGL
}
@@ -276,10 +278,10 @@ bool Graphics::setOpenGLMode() restrict2
#if defined(USE_X11)
Glx::initFunctions();
-#endif
+#endif // defined(USE_X11)
#ifdef __native_client__
NaclGles::initGles();
-#endif
+#endif // __native_client__
#ifdef USE_SDL2
int w1 = 0;
@@ -303,7 +305,7 @@ bool Graphics::setOpenGLMode() restrict2
const GLint VBL = 1;
CGLSetParameter(CGLGetCurrentContext(), kCGLCPSwapInterval, &VBL);
}
-#endif
+#endif // __APPLE__
graphicsManager.setGLVersion();
graphicsManager.logVersion();
@@ -344,7 +346,7 @@ bool Graphics::setOpenGLMode() restrict2
#ifndef ANDROID
SafeOpenGLImageHelper::mTextureType = GL_TEXTURE_RECTANGLE_ARB;
SafeOpenGLImageHelper::mTextureSize = texSize;
-#endif
+#endif // ANDROID
}
else
{
@@ -354,7 +356,8 @@ bool Graphics::setOpenGLMode() restrict2
#ifndef ANDROID
SafeOpenGLImageHelper::mTextureType = GL_TEXTURE_2D;
SafeOpenGLImageHelper::mTextureSize = texSize;
-#endif
+#endif // ANDROID
+
logger->log("OpenGL texture size: %d pixels",
OpenGLImageHelper::mTextureSize);
}
@@ -369,14 +372,15 @@ int Graphics::getSoftwareFlags() const restrict2
{
#ifdef USE_SDL2
int displayFlags = SDL_WINDOW_SHOWN;
-#else
+#else // USE_SDL2
+
int displayFlags = SDL_ANYFORMAT;
if (mHWAccel)
displayFlags |= SDL_HWSURFACE | SDL_DOUBLEBUF;
else
displayFlags |= SDL_SWSURFACE;
-#endif
+#endif // USE_SDL2
if (mFullscreen)
displayFlags |= SDL_FULLSCREEN;
@@ -393,9 +397,9 @@ void Graphics::createGLContext(const bool custom A_UNUSED) restrict2
{
#ifdef USE_SDL2
mGLContext = SDL_GL_CreateContext(mWindow);
-#endif
+#endif // USE_SDL2
}
-#endif
+#endif // USE_OPENGL
void Graphics::updateMemoryInfo() restrict2
{
@@ -409,7 +413,7 @@ void Graphics::updateMemoryInfo() restrict2
&mStartFreeMem);
logger->log("free video memory: %d", mStartFreeMem);
}
-#endif
+#endif // USE_OPENGL
}
int Graphics::getMemoryUsage() const restrict2
@@ -425,7 +429,7 @@ int Graphics::getMemoryUsage() const restrict2
&val);
return mStartFreeMem - val;
}
-#endif
+#endif // USE_OPENGL
return 0;
}
@@ -445,7 +449,7 @@ void Graphics::dumpRendererInfo(const char *restrict const str,
if (info.flags & SDL_RENDERER_TARGETTEXTURE)
logger->log(" texture target");
}
-#endif
+#endif // USE_SDL2
bool Graphics::videoInfo() restrict2
{
@@ -467,7 +471,8 @@ bool Graphics::videoInfo() restrict2
dumpRendererInfo("renderer name: %s", info);
}
}
-#else
+#else // USE_SDL2
+
char videoDriverName[65];
if (SDL_VideoDriverName(videoDriverName, 64))
logger->log("Using video driver: %s", videoDriverName);
@@ -500,7 +505,7 @@ bool Graphics::videoInfo() restrict2
((vi->blit_sw_A) ? "yes" : "no"));
logger->log("Accelerated color fills: %s",
((vi->blit_fill) ? "yes" : "no"));
-#endif
+#endif // USE_SDL2
return true;
}
@@ -614,12 +619,12 @@ void Graphics::setWindowSize(const int width,
{
SDL_SetWindowSize(mWindow, width, height);
}
-#else
+#else // USE_SDL2
void Graphics::setWindowSize(const int width A_UNUSED,
const int height A_UNUSED) restrict2
{
}
-#endif
+#endif // USE_SDL2
void Graphics::pushClipArea(const Rect &restrict area) restrict2
{
@@ -713,10 +718,11 @@ void Graphics::setOpenGLFlags() restrict2
#ifndef ANDROID
#ifndef __MINGW32__
glHint(GL_TEXTURE_COMPRESSION_HINT, GL_FASTEST);
-#endif
-#endif
+#endif // __MINGW32__
+#endif // ANDROID
+
glHint(GL_TEXTURE_COMPRESSION_HINT_ARB, GL_FASTEST);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
-#endif
+#endif // USE_OPENGL
diff --git a/src/render/graphics.h b/src/render/graphics.h
index 997ed2196..b2e38367d 100644
--- a/src/render/graphics.h
+++ b/src/render/graphics.h
@@ -86,10 +86,10 @@
#ifdef USE_SDL2
#define RectPos int32_t
#define RectSize int32_t
-#else
+#else // USE_SDL2
#define RectPos int16_t
#define RectSize uint16_t
-#endif
+#endif // USE_SDL2
class Image;
class ImageCollection;
@@ -106,7 +106,8 @@ class Graphics notfinal
public:
#ifdef USE_OPENGL
friend class OpenGLScreenshotHelper;
-#endif
+#endif // USE_SDL2
+
friend class SdlScreenshotHelper;
A_DELETE_COPY(Graphics)
@@ -250,9 +251,9 @@ class Graphics notfinal
void setWindowSize(const int width,
#ifdef USE_SDL2
const int height) restrict2;
-#else
+#else // USE_SDL2
const int height) restrict2 A_CONST;
-#endif
+#endif // USE_SDL2
/**
* Returns the width of the screen.
@@ -321,18 +322,18 @@ class Graphics notfinal
#ifdef DEBUG_DRAW_CALLS
virtual unsigned int getDrawCalls() const restrict2
{ return 0; }
-#endif
+#endif // DEBUG_DRAW_CALLS
#ifdef DEBUG_BIND_TEXTURE
virtual unsigned int getBinds() const restrict2
{ return 0; }
-#endif
+#endif // DEBUG_BIND_TEXTURE
#ifdef USE_SDL2
void dumpRendererInfo(const char *restrict const str,
const SDL_RendererInfo &restrict info) restrict2;
virtual void setRendererFlags(const uint32_t flags A_UNUSED) restrict2
{ }
-#endif
+#endif // USE_SDL2
/**
* Blits an image onto the screen.
@@ -405,10 +406,11 @@ class Graphics notfinal
#ifdef USE_OPENGL
#ifdef USE_SDL2
virtual void createGLContext(const bool custom) restrict2;
-#else
+#else // USE_SDL2
+
virtual void createGLContext(const bool custom) restrict2 A_CONST;
-#endif
-#endif
+#endif // USE_SDL2
+#endif // USE_OPENGL
/**
* Draws a single point/pixel.
@@ -503,7 +505,8 @@ class Graphics notfinal
#ifdef USE_OPENGL
void setOpenGLFlags() restrict2;
-#endif
+#endif // USE_OPENGL
+
/**
* Holds the clip area stack.
*/
diff --git a/src/render/mobileopengl2graphics.cpp b/src/render/mobileopengl2graphics.cpp
index 576bc67ab..574e16a40 100644
--- a/src/render/mobileopengl2graphics.cpp
+++ b/src/render/mobileopengl2graphics.cpp
@@ -29,7 +29,7 @@
#include "render/opengl/mgl.h"
#ifdef __native_client__
#include "render/opengl/naclglfunctions.h"
-#endif
+#endif // __native_client__
#include "render/shaders/shaderprogram.h"
#include "render/shaders/shadersmanager.h"
@@ -85,7 +85,7 @@ int MobileOpenGL2Graphics::mTextureHeight = 1;
#ifdef DEBUG_DRAW_CALLS
unsigned int MobileOpenGL2Graphics::mDrawCalls = 0U;
unsigned int MobileOpenGL2Graphics::mLastDrawCalls = 0U;
-#endif
+#endif // DEBUG_DRAW_CALLS
MobileOpenGL2Graphics::MobileOpenGL2Graphics() :
mFloatArray(nullptr),
@@ -103,7 +103,7 @@ MobileOpenGL2Graphics::MobileOpenGL2Graphics() :
mDrawTypeUniform(0U),
#ifndef __native_client__
mVao(0U),
-#endif
+#endif // __native_client__
mVbo(0U),
mVboBinded(0U),
mAttributesBinded(0U),
@@ -112,7 +112,7 @@ MobileOpenGL2Graphics::MobileOpenGL2Graphics() :
#ifdef DEBUG_BIND_TEXTURE
mOldTexture(),
mOldTextureId(0),
-#endif
+#endif // DEBUG_BIND_TEXTURE
mFbo()
{
mOpenGL = RENDER_GLES2_OPENGL;
@@ -133,7 +133,7 @@ void MobileOpenGL2Graphics::deleteGLObjects() restrict2
#ifndef __native_client__
if (mVao)
mglDeleteVertexArrays(1, &mVao);
-#endif
+#endif // __native_client__
}
void MobileOpenGL2Graphics::initArrays(const int vertCount) restrict2
@@ -158,7 +158,7 @@ void MobileOpenGL2Graphics::postInit() restrict2
#ifndef __native_client__
mglGenVertexArrays(1, &mVao);
mglBindVertexArray(mVao);
-#endif
+#endif // __native_client__
mglGenBuffers(1, &mVbo);
// logger->log("gen vbo buffer: %u", mVbo);
bindArrayBuffer(mVbo);
@@ -287,7 +287,7 @@ void MobileOpenGL2Graphics::drawQuad(const int srcX,
vertices, GL_STREAM_DRAW);
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
-#endif
+#endif // DEBUG_DRAW_CALLS
mglDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}
@@ -318,7 +318,7 @@ void MobileOpenGL2Graphics::drawRescaledQuad(const int srcX, const int srcY,
vertices, GL_STREAM_DRAW);
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
-#endif
+#endif // DEBUG_DRAW_CALLS
mglDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}
@@ -337,7 +337,7 @@ void MobileOpenGL2Graphics::drawImageInline(const Image *restrict const image,
#ifdef DEBUG_BIND_TEXTURE
debugBindTexture(image);
-#endif
+#endif // DEBUG_BIND_TEXTURE
bindTexture2(GL_TEXTURE_2D, image);
setTexturingAndBlending(true);
bindArrayBufferAndAttributes(mVbo);
@@ -375,7 +375,7 @@ void MobileOpenGL2Graphics::testDraw() restrict2
// vertices, GL_STREAM_DRAW);
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
-#endif
+#endif // DEBUG_DRAW_CALLS
mglDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
// glDrawElements(GL_TRIANGLE_STRIP, 4, GL_UNSIGNED_INT, 0);
}
@@ -422,7 +422,7 @@ void MobileOpenGL2Graphics::drawRescaledImage(const Image *
setColorAlpha(image->mAlpha);
#ifdef DEBUG_BIND_TEXTURE
debugBindTexture(image);
-#endif
+#endif // DEBUG_BIND_TEXTURE
bindTexture2(GL_TEXTURE_2D, image);
setTexturingAndBlending(true);
bindArrayBufferAndAttributes(mVbo);
@@ -472,7 +472,7 @@ void MobileOpenGL2Graphics::drawPatternInline(const Image *
#ifdef DEBUG_BIND_TEXTURE
debugBindTexture(image);
-#endif
+#endif // DEBUG_BIND_TEXTURE
bindTexture2(GL_TEXTURE_2D, image);
setTexturingAndBlending(true);
@@ -536,7 +536,7 @@ void MobileOpenGL2Graphics::drawRescaledPattern(const Image *
#ifdef DEBUG_BIND_TEXTURE
debugBindTexture(image);
-#endif
+#endif // DEBUG_BIND_TEXTURE
bindTexture2(GL_TEXTURE_2D, image);
setTexturingAndBlending(true);
@@ -601,7 +601,7 @@ inline void MobileOpenGL2Graphics::drawVertexes(const
bindArrayBufferAndAttributes(*ivbo);
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
-#endif
+#endif // DEBUG_DRAW_CALLS
mglDrawArrays(GL_TRIANGLES, 0, *ivp / 4);
}
}
@@ -718,7 +718,7 @@ void MobileOpenGL2Graphics::drawTileCollection(const ImageCollection
setColorAlpha(image->mAlpha);
#ifdef DEBUG_BIND_TEXTURE
debugBindTexture(image);
-#endif
+#endif // DEBUG_BIND_TEXTURE
bindTexture2(GL_TEXTURE_2D, image);
drawVertexes(vert->ogl);
}
@@ -819,7 +819,7 @@ void MobileOpenGL2Graphics::drawTileVertexes(const ImageVertexes *
setColorAlpha(image->mAlpha);
#ifdef DEBUG_BIND_TEXTURE
debugBindTexture(image);
-#endif
+#endif // DEBUG_BIND_TEXTURE
bindTexture2(GL_TEXTURE_2D, image);
setTexturingAndBlending(true);
bindArrayBufferAndAttributes(mVbo);
@@ -858,16 +858,16 @@ void MobileOpenGL2Graphics::updateScreen() restrict2
#ifdef DEBUG_DRAW_CALLS
mLastDrawCalls = mDrawCalls;
mDrawCalls = 0;
-#endif
+#endif // DEBUG_DRAW_CALLS
#ifdef USE_SDL2
SDL_GL_SwapWindow(mWindow);
-#else
+#else // USE_SDL2
SDL_GL_SwapBuffers();
-#endif
+#endif // USE_SDL2
#ifdef DEBUG_OPENGL
if (isGLNotNull(mglFrameTerminator))
mglFrameTerminator();
-#endif
+#endif // DEBUG_OPENGL
BLOCK_END("Graphics::updateScreen")
}
@@ -877,7 +877,7 @@ void MobileOpenGL2Graphics::beginDraw() restrict2
#ifndef __native_client__
mglDisable(GL_VERTEX_PROGRAM_POINT_SIZE_ARB);
mglHint(GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB, GL_FASTEST);
-#endif
+#endif // __native_client__
pushClipArea(Rect(0, 0, mRect.w, mRect.h));
}
@@ -925,7 +925,7 @@ void MobileOpenGL2Graphics::drawPoint(int x, int y) restrict2
vertices, GL_STREAM_DRAW);
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
-#endif
+#endif // DEBUG_DRAW_CALLS
mglDrawArrays(GL_POINTS, 0, 1);
}
@@ -944,7 +944,7 @@ void MobileOpenGL2Graphics::drawLine(int x1, int y1,
vertices, GL_STREAM_DRAW);
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
-#endif
+#endif // DEBUG_DRAW_CALLS
mglDrawArrays(GL_LINES, 0, 2);
}
@@ -969,7 +969,7 @@ void MobileOpenGL2Graphics::drawRectangle(const Rect &restrict rect) restrict2
vertices, GL_STREAM_DRAW);
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
-#endif
+#endif // DEBUG_DRAW_CALLS
mglDrawArrays(GL_LINE_LOOP, 0, 4);
}
@@ -994,7 +994,7 @@ void MobileOpenGL2Graphics::fillRectangle(const Rect &restrict rect) restrict2
vertices, GL_STREAM_DRAW);
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
-#endif
+#endif // DEBUG_DRAW_CALLS
mglDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}
@@ -1291,7 +1291,7 @@ void MobileOpenGL2Graphics::drawTriangleArray(const int size) restrict2
mFloatArray, GL_STREAM_DRAW);
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
-#endif
+#endif // DEBUG_DRAW_CALLS
mglDrawArrays(GL_TRIANGLES, 0, size / 4);
}
@@ -1303,7 +1303,7 @@ void MobileOpenGL2Graphics::drawTriangleArray(const GLfloat *restrict const
array, GL_STREAM_DRAW);
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
-#endif
+#endif // DEBUG_DRAW_CALLS
mglDrawArrays(GL_TRIANGLES, 0, size / 4);
}
@@ -1313,7 +1313,7 @@ void MobileOpenGL2Graphics::drawLineArrays(const int size) restrict2
mFloatArray, GL_STREAM_DRAW);
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
-#endif
+#endif // DEBUG_DRAW_CALLS
mglDrawArrays(GL_LINES, 0, size / 4);
}
@@ -1334,11 +1334,11 @@ void MobileOpenGL2Graphics::debugBindTexture(const Image *restrict const image)
mOldTexture = texture;
}
}
-#else
+#else // DEBUG_BIND_TEXTURE
void MobileOpenGL2Graphics::debugBindTexture(const Image *restrict const
image A_UNUSED) restrict2
{
}
-#endif
+#endif // DEBUG_BIND_TEXTURE
#endif // USE_OPENGL
diff --git a/src/render/mobileopengl2graphics.h b/src/render/mobileopengl2graphics.h
index 2efa367c4..217e86609 100644
--- a/src/render/mobileopengl2graphics.h
+++ b/src/render/mobileopengl2graphics.h
@@ -142,7 +142,8 @@ class MobileOpenGL2Graphics final : public Graphics
GLuint mDrawTypeUniform;
#ifndef __native_client__
GLuint mVao;
-#endif
+#endif // __native_client__
+
GLuint mVbo;
GLuint mVboBinded;
GLuint mAttributesBinded;
@@ -151,7 +152,8 @@ class MobileOpenGL2Graphics final : public Graphics
#ifdef DEBUG_BIND_TEXTURE
std::string mOldTexture;
unsigned mOldTextureId;
-#endif
+#endif // DEBUG_BIND_TEXTURE
+
FBOInfo mFbo;
};
#endif // defined(USE_OPENGL) && !defined(ANDROID)
diff --git a/src/render/mobileopenglgraphics.cpp b/src/render/mobileopenglgraphics.cpp
index 83d57e33b..77e89c447 100644
--- a/src/render/mobileopenglgraphics.cpp
+++ b/src/render/mobileopenglgraphics.cpp
@@ -27,7 +27,7 @@
#include "render/opengl/mgl.h"
#ifdef __native_client__
#include "render/opengl/naclglfunctions.h"
-#endif
+#endif // __native_client__
#include "render/vertexes/imagecollection.h"
@@ -70,7 +70,7 @@ GLuint MobileOpenGLGraphics::mTextureBinded = 0;
#ifdef DEBUG_DRAW_CALLS
unsigned int MobileOpenGLGraphics::mDrawCalls = 0;
unsigned int MobileOpenGLGraphics::mLastDrawCalls = 0;
-#endif
+#endif // DEBUG_DRAW_CALLS
MobileOpenGLGraphics::MobileOpenGLGraphics() :
mFloatTexArray(nullptr),
@@ -89,7 +89,7 @@ MobileOpenGLGraphics::MobileOpenGLGraphics() :
#ifdef DEBUG_BIND_TEXTURE
mOldTexture(),
mOldTextureId(0),
-#endif
+#endif // DEBUG_BIND_TEXTURE
mFbo()
{
mOpenGL = RENDER_GLES_OPENGL;
@@ -205,7 +205,7 @@ static inline void drawQuad(const Image *restrict const image,
#ifdef DEBUG_DRAW_CALLS
MobileOpenGLGraphics::mDrawCalls ++;
-#endif
+#endif // DEBUG_DRAW_CALLS
mglDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}
}
@@ -258,7 +258,7 @@ static inline void drawRescaledQuad(const Image *restrict const image,
#ifdef DEBUG_DRAW_CALLS
MobileOpenGLGraphics::mDrawCalls ++;
-#endif
+#endif // DEBUG_DRAW_CALLS
mglDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}
}
@@ -279,7 +279,7 @@ void MobileOpenGLGraphics::drawImageInline(const Image *restrict const image,
setColorAlpha(image->mAlpha);
#ifdef DEBUG_BIND_TEXTURE
debugBindTexture(image);
-#endif
+#endif // DEBUG_BIND_TEXTURE
bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage);
setTexturingAndBlending(true);
@@ -415,7 +415,7 @@ void MobileOpenGLGraphics::completeCache() restrict2
setColorAlpha(mAlphaCached);
#ifdef DEBUG_BIND_TEXTURE
// debugBindTexture(image);
-#endif
+#endif // DEBUG_BIND_TEXTURE
bindTexture(OpenGLImageHelper::mTextureType, mImageCached);
setTexturingAndBlending(true);
@@ -445,7 +445,7 @@ void MobileOpenGLGraphics::drawRescaledImage(const Image *restrict const image,
setColorAlpha(image->mAlpha);
#ifdef DEBUG_BIND_TEXTURE
debugBindTexture(image);
-#endif
+#endif // DEBUG_BIND_TEXTURE
bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage);
setTexturingAndBlending(true);
@@ -487,7 +487,7 @@ void MobileOpenGLGraphics::drawPatternInline(const Image *restrict const image,
#ifdef DEBUG_BIND_TEXTURE
debugBindTexture(image);
-#endif
+#endif // DEBUG_BIND_TEXTURE
bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage);
setTexturingAndBlending(true);
@@ -552,7 +552,7 @@ void MobileOpenGLGraphics::drawRescaledPattern(const Image *
#ifdef DEBUG_BIND_TEXTURE
debugBindTexture(image);
-#endif
+#endif // DEBUG_BIND_TEXTURE
bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage);
setTexturingAndBlending(true);
@@ -745,7 +745,7 @@ void MobileOpenGLGraphics::drawTileCollection(const ImageCollection *
setColorAlpha(image->mAlpha);
#ifdef DEBUG_BIND_TEXTURE
debugBindTexture(image);
-#endif
+#endif // DEBUG_BIND_TEXTURE
bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage);
setTexturingAndBlending(true);
drawVertexes(vert->ogl);
@@ -848,7 +848,7 @@ void MobileOpenGLGraphics::drawTileVertexes(const ImageVertexes *
setColorAlpha(image->mAlpha);
#ifdef DEBUG_BIND_TEXTURE
debugBindTexture(image);
-#endif
+#endif // DEBUG_BIND_TEXTURE
bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage);
setTexturingAndBlending(true);
drawVertexes(vert->ogl);
@@ -888,16 +888,18 @@ void MobileOpenGLGraphics::updateScreen() restrict2
#ifdef DEBUG_DRAW_CALLS
mLastDrawCalls = mDrawCalls;
mDrawCalls = 0;
-#endif
+#endif // DEBUG_DRAW_CALLS
#ifdef USE_SDL2
SDL_GL_SwapWindow(mWindow);
-#else
+#else // USE_SDL2
+
SDL_GL_SwapBuffers();
-#endif
+#endif // USE_SDL2
#ifdef DEBUG_OPENGL
if (isGLNotNull(mglFrameTerminator))
mglFrameTerminator();
-#endif
+#endif // DEBUG_OPENGL
+
BLOCK_END("Graphics::updateScreen")
}
@@ -913,11 +915,12 @@ void MobileOpenGLGraphics::beginDraw() restrict2
glOrthof(0.0, static_cast<float>(mRect.w),
static_cast<float>(mRect.h),
0.0, -1.0, 1.0);
-#else
+#else // ANDROID
+
glOrtho(0.0, static_cast<double>(mRect.w),
static_cast<double>(mRect.h),
0.0, -1.0, 1.0);
-#endif
+#endif // ANDROID
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
@@ -937,7 +940,7 @@ void MobileOpenGLGraphics::beginDraw() restrict2
mglHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
mglHint(GL_POINT_SMOOTH_HINT, GL_FASTEST);
mglHint(GL_POLYGON_SMOOTH_HINT, GL_FASTEST);
-#endif
+#endif // ANDROID
pushClipArea(Rect(0, 0, mRect.w, mRect.h));
}
@@ -1006,20 +1009,21 @@ void MobileOpenGLGraphics::popClipArea() restrict2
#ifdef ANDROID
void MobileOpenGLGraphics::drawPoint(int x A_UNUSED, int y A_UNUSED) restrict2
-#else
+#else // ANDROID
void MobileOpenGLGraphics::drawPoint(int x, int y) restrict2
-#endif
+#endif // ANDROID
{
setTexturingAndBlending(false);
restoreColor();
#ifdef ANDROID
// TODO need fix
-#else
+#else // ANDROID
+
glBegin(GL_POINTS);
glVertex2i(x, y);
glEnd();
-#endif
+#endif // ANDROID
}
void MobileOpenGLGraphics::drawLine(int x1, int y1,
@@ -1113,7 +1117,8 @@ void MobileOpenGLGraphics::drawRectangle(const Rect &restrict rect,
glVertexPointer(2, GL_SHORT, 0, &vert);
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
-#endif
+#endif // DEBUG_DRAW_CALLS
+
mglDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}
else
@@ -1129,7 +1134,8 @@ void MobileOpenGLGraphics::drawRectangle(const Rect &restrict rect,
glVertexPointer(2, GL_SHORT, 0, &vert);
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
-#endif
+#endif // DEBUG_DRAW_CALLS
+
mglDrawArrays(GL_LINE_LOOP, 0, 4);
}
BLOCK_END("Graphics::drawRectangle")
@@ -1205,7 +1211,8 @@ inline void MobileOpenGLGraphics::drawTriangleArrayfs(const int size) restrict2
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
-#endif
+#endif // DEBUG_DRAW_CALLS
+
mglDrawArrays(GL_TRIANGLES, 0, size / 2);
}
@@ -1217,7 +1224,8 @@ inline void MobileOpenGLGraphics::drawTriangleArrayfsCached(const int size)
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
-#endif
+#endif // DEBUG_DRAW_CALLS
+
mglDrawArrays(GL_TRIANGLES, 0, size / 2);
}
@@ -1232,7 +1240,8 @@ inline void MobileOpenGLGraphics::drawTriangleArrayfs(const GLshort *restrict
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
-#endif
+#endif // DEBUG_DRAW_CALLS
+
mglDrawArrays(GL_TRIANGLES, 0, size / 2);
}
@@ -1242,7 +1251,8 @@ inline void MobileOpenGLGraphics::drawLineArrays(const int size) restrict2
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
-#endif
+#endif // DEBUG_DRAW_CALLS
+
mglDrawArrays(GL_LINES, 0, size / 2);
}
@@ -1330,11 +1340,12 @@ void MobileOpenGLGraphics::debugBindTexture(const Image *restrict const image)
mOldTexture = texture;
}
}
-#else
+#else // DEBUG_BIND_TEXTURE
+
void MobileOpenGLGraphics::debugBindTexture(const Image *restrict const
image A_UNUSED) restrict2
{
}
-#endif
+#endif // DEBUG_BIND_TEXTURE
#endif // defined(USE_OPENGL) && !defined(__native_client__)
diff --git a/src/render/mobileopenglgraphics.h b/src/render/mobileopenglgraphics.h
index a428b138a..f472abe58 100644
--- a/src/render/mobileopenglgraphics.h
+++ b/src/render/mobileopenglgraphics.h
@@ -35,17 +35,17 @@
#include <GLES/gl.h>
#include <GLES/glext.h>
#include <GLES2/gl2.h>
-#else
+#else // ANDROID
#ifndef USE_SDL2
#define GL_GLEXT_PROTOTYPES 1
-#endif
+#endif // USE_SDL2
#include <SDL_opengl.h>
#if defined(__APPLE__)
#include <OpenGL/glext.h>
#elif !defined(__native_client__)
#include <GL/glext.h>
#endif // defined(__APPLE__)
-#endif
+#endif // ANDROID
class OpenGLGraphicsVertexes;
@@ -103,7 +103,8 @@ class MobileOpenGLGraphics final : public Graphics
#ifdef DEBUG_BIND_TEXTURE
std::string mOldTexture;
unsigned mOldTextureId;
-#endif
+#endif // DEBUG_BIND_TEXTURE
+
FBOInfo mFbo;
};
#endif // defined(USE_OPENGL) && !defined(__native_client__)
diff --git a/src/render/modernopenglgraphics.cpp b/src/render/modernopenglgraphics.cpp
index 1629dbea5..10f5d209a 100644
--- a/src/render/modernopenglgraphics.cpp
+++ b/src/render/modernopenglgraphics.cpp
@@ -29,7 +29,7 @@
#include "render/opengl/mgl.h"
#ifdef __native_client__
#include "render/opengl/naclglfunctions.h"
-#endif
+#endif // __native_client__
#include "render/shaders/shaderprogram.h"
#include "render/shaders/shadersmanager.h"
@@ -82,7 +82,7 @@ GLuint ModernOpenGLGraphics::mTextureBinded = 0;
#ifdef DEBUG_DRAW_CALLS
unsigned int ModernOpenGLGraphics::mDrawCalls = 0;
unsigned int ModernOpenGLGraphics::mLastDrawCalls = 0;
-#endif
+#endif // DEBUG_DRAW_CALLS
ModernOpenGLGraphics::ModernOpenGLGraphics() :
mIntArray(nullptr),
@@ -109,7 +109,7 @@ ModernOpenGLGraphics::ModernOpenGLGraphics() :
#ifdef DEBUG_BIND_TEXTURE
mOldTexture(),
mOldTextureId(0),
-#endif
+#endif // DEBUG_BIND_TEXTURE
mFbo()
{
mOpenGL = RENDER_MODERN_OPENGL;
@@ -285,7 +285,7 @@ void ModernOpenGLGraphics::drawQuad(const int srcX,
vertices, GL_STREAM_DRAW);
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
-#endif
+#endif // DEBUG_DRAW_CALLS
mglDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}
@@ -313,7 +313,7 @@ void ModernOpenGLGraphics::drawRescaledQuad(const int srcX, const int srcY,
vertices, GL_STREAM_DRAW);
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
-#endif
+#endif // DEBUG_DRAW_CALLS
mglDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}
@@ -332,7 +332,7 @@ void ModernOpenGLGraphics::drawImageInline(const Image *restrict const image,
#ifdef DEBUG_BIND_TEXTURE
debugBindTexture(image);
-#endif
+#endif // DEBUG_BIND_TEXTURE
bindTexture(GL_TEXTURE_2D, image->mGLImage);
setTexturingAndBlending(true);
bindArrayBufferAndAttributes(mVbo);
@@ -370,7 +370,7 @@ void ModernOpenGLGraphics::testDraw() restrict2
// elements, GL_STREAM_DRAW);
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
-#endif
+#endif // DEBUG_DRAW_CALLS
mglDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
// glDrawElements(GL_TRIANGLE_STRIP, 4, GL_UNSIGNED_INT, 0);
}
@@ -415,7 +415,7 @@ void ModernOpenGLGraphics::drawRescaledImage(const Image *restrict const image,
setColorAlpha(image->mAlpha);
#ifdef DEBUG_BIND_TEXTURE
debugBindTexture(image);
-#endif
+#endif // DEBUG_BIND_TEXTURE
bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage);
setTexturingAndBlending(true);
bindArrayBufferAndAttributes(mVbo);
@@ -459,7 +459,8 @@ void ModernOpenGLGraphics::drawPatternInline(const Image *restrict const image,
#ifdef DEBUG_BIND_TEXTURE
debugBindTexture(image);
-#endif
+#endif // DEBUG_BIND_TEXTURE
+
bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage);
setTexturingAndBlending(true);
@@ -521,7 +522,8 @@ void ModernOpenGLGraphics::drawRescaledPattern(const Image *
#ifdef DEBUG_BIND_TEXTURE
debugBindTexture(image);
-#endif
+#endif // DEBUG_BIND_TEXTURE
+
bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage);
setTexturingAndBlending(true);
@@ -589,7 +591,7 @@ inline void ModernOpenGLGraphics::drawVertexes(const
bindArrayBufferAndAttributes(*ivbo);
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
-#endif
+#endif // DEBUG_DRAW_CALLS
// logger->log("draw from array: %u", *ivbo);
mglDrawArrays(GL_TRIANGLES, 0, *ivp / 4);
}
@@ -708,7 +710,8 @@ void ModernOpenGLGraphics::drawTileCollection(const ImageCollection
setColorAlpha(image->mAlpha);
#ifdef DEBUG_BIND_TEXTURE
debugBindTexture(image);
-#endif
+#endif // DEBUG_BIND_TEXTURE
+
bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage);
drawVertexes(vert->ogl);
}
@@ -803,7 +806,8 @@ void ModernOpenGLGraphics::drawTileVertexes(const ImageVertexes *
setColorAlpha(image->mAlpha);
#ifdef DEBUG_BIND_TEXTURE
debugBindTexture(image);
-#endif
+#endif // DEBUG_BIND_TEXTURE
+
bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage);
setTexturingAndBlending(true);
bindArrayBufferAndAttributes(mVbo);
@@ -842,16 +846,16 @@ void ModernOpenGLGraphics::updateScreen() restrict2
#ifdef DEBUG_DRAW_CALLS
mLastDrawCalls = mDrawCalls;
mDrawCalls = 0;
-#endif
+#endif // DEBUG_DRAW_CALLS
#ifdef USE_SDL2
SDL_GL_SwapWindow(mWindow);
-#else
+#else // USE_SDL2
SDL_GL_SwapBuffers();
-#endif
+#endif // USE_SDL2
#ifdef DEBUG_OPENGL
if (isGLNotNull(mglFrameTerminator))
mglFrameTerminator();
-#endif
+#endif // DEBUG_OPENGL
BLOCK_END("Graphics::updateScreen")
}
@@ -908,7 +912,7 @@ void ModernOpenGLGraphics::drawPoint(int x, int y) restrict2
vertices, GL_STREAM_DRAW);
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
-#endif
+#endif // DEBUG_DRAW_CALLS
mglDrawArrays(GL_POINTS, 0, 1);
}
@@ -928,7 +932,7 @@ void ModernOpenGLGraphics::drawLine(int x1, int y1,
vertices, GL_STREAM_DRAW);
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
-#endif
+#endif // DEBUG_DRAW_CALLS
mglDrawArrays(GL_LINES, 0, 2);
}
@@ -954,7 +958,7 @@ void ModernOpenGLGraphics::drawRectangle(const Rect &restrict rect) restrict2
vertices, GL_STREAM_DRAW);
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
-#endif
+#endif // DEBUG_DRAW_CALLS
mglDrawArrays(GL_LINE_LOOP, 0, 4);
}
@@ -980,7 +984,7 @@ void ModernOpenGLGraphics::fillRectangle(const Rect &restrict rect) restrict2
vertices, GL_STREAM_DRAW);
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
-#endif
+#endif // DEBUG_DRAW_CALLS
mglDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}
@@ -1298,7 +1302,7 @@ void ModernOpenGLGraphics::drawTriangleArray(const int size) restrict2
mIntArray, GL_STREAM_DRAW);
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
-#endif
+#endif // DEBUG_DRAW_CALLS
mglDrawArrays(GL_TRIANGLES, 0, size / 4);
}
@@ -1310,7 +1314,7 @@ void ModernOpenGLGraphics::drawTriangleArray(const GLint *restrict const array,
array, GL_STREAM_DRAW);
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
-#endif
+#endif // DEBUG_DRAW_CALLS
mglDrawArrays(GL_TRIANGLES, 0, size / 4);
}
@@ -1321,7 +1325,7 @@ void ModernOpenGLGraphics::drawLineArrays(const int size)
mIntArray, GL_STREAM_DRAW);
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
-#endif
+#endif // DEBUG_DRAW_CALLS
mglDrawArrays(GL_LINES, 0, size / 4);
}
@@ -1342,12 +1346,12 @@ void ModernOpenGLGraphics::debugBindTexture(const Image *restrict const image)
mOldTexture = texture;
}
}
-#else
+#else // DEBUG_BIND_TEXTURE
void ModernOpenGLGraphics::debugBindTexture(const Image *restrict const
image A_UNUSED) restrict2
{
}
-#endif
+#endif // DEBUG_BIND_TEXTURE
#endif // defined(USE_OPENGL) && !defined(ANDROID) &&
// !defined(__native_client__)
diff --git a/src/render/modernopenglgraphics.h b/src/render/modernopenglgraphics.h
index 53d6966c2..f81e152ad 100644
--- a/src/render/modernopenglgraphics.h
+++ b/src/render/modernopenglgraphics.h
@@ -35,17 +35,17 @@
#include <GLES/gl.h>
#include <GLES/glext.h>
#include <GLES2/gl2.h>
-#else
+#else // ANDROID
#ifndef USE_SDL2
#define GL_GLEXT_PROTOTYPES 1
-#endif
+#endif // USE_SDL2
#include <SDL_opengl.h>
#if defined(__APPLE__)
#include <OpenGL/glext.h>
#elif !defined(__native_client__)
#include <GL/glext.h>
#endif // defined(__APPLE__)
-#endif
+#endif // ANDROID
class OpenGLGraphicsVertexes;
class ShaderProgram;
@@ -146,7 +146,8 @@ class ModernOpenGLGraphics final : public Graphics
#ifdef DEBUG_BIND_TEXTURE
std::string mOldTexture;
unsigned mOldTextureId;
-#endif
+#endif // DEBUG_BIND_TEXTURE
+
FBOInfo mFbo;
};
#endif // defined(USE_OPENGL) && !defined(ANDROID) &&
diff --git a/src/render/normalopenglgraphics.cpp b/src/render/normalopenglgraphics.cpp
index 3a2bfde49..7ca56e624 100644
--- a/src/render/normalopenglgraphics.cpp
+++ b/src/render/normalopenglgraphics.cpp
@@ -85,11 +85,11 @@ GLuint NormalOpenGLGraphics::mTextureBinded = 0;
#ifdef DEBUG_DRAW_CALLS
unsigned int NormalOpenGLGraphics::mDrawCalls = 0;
unsigned int NormalOpenGLGraphics::mLastDrawCalls = 0;
-#endif
+#endif // DEBUG_DRAW_CALLS
#ifdef DEBUG_BIND_TEXTURE
unsigned int NormalOpenGLGraphics::mBinds = 0;
unsigned int NormalOpenGLGraphics::mLastBinds = 0;
-#endif
+#endif // DEBUG_BIND_TEXTURE
NormalOpenGLGraphics::NormalOpenGLGraphics() :
mFloatTexArray(nullptr),
@@ -110,7 +110,7 @@ NormalOpenGLGraphics::NormalOpenGLGraphics() :
#ifdef DEBUG_BIND_TEXTURE
mOldTexture(),
mOldTextureId(0),
-#endif
+#endif // DEBUG_BIND_TEXTURE
mFbo()
{
mOpenGL = RENDER_NORMAL_OPENGL;
@@ -250,7 +250,8 @@ static inline void drawQuad(const Image *restrict const image,
bindPointerIntFloat(&vert[0], &tex[0]);
#ifdef DEBUG_DRAW_CALLS
NormalOpenGLGraphics::mDrawCalls ++;
-#endif
+#endif // DEBUG_DRAW_CALLS
+
glDrawArrays(GL_QUADS, 0, 4);
}
else
@@ -273,7 +274,8 @@ static inline void drawQuad(const Image *restrict const image,
bindPointerInt(&vert[0], &tex[0]);
#ifdef DEBUG_DRAW_CALLS
NormalOpenGLGraphics::mDrawCalls ++;
-#endif
+#endif // DEBUG_DRAW_CALLS
+
glDrawArrays(GL_QUADS, 0, 4);
}
}
@@ -322,7 +324,8 @@ static inline void drawRescaledQuad(const Image *restrict const image,
bindPointerIntFloat(&vert[0], &tex[0]);
#ifdef DEBUG_DRAW_CALLS
NormalOpenGLGraphics::mDrawCalls ++;
-#endif
+#endif // DEBUG_DRAW_CALLS
+
glDrawArrays(GL_QUADS, 0, 4);
}
else
@@ -345,7 +348,8 @@ static inline void drawRescaledQuad(const Image *restrict const image,
bindPointerInt(&vert[0], &tex[0]);
#ifdef DEBUG_DRAW_CALLS
NormalOpenGLGraphics::mDrawCalls ++;
-#endif
+#endif // DEBUG_DRAW_CALLS
+
glDrawArrays(GL_QUADS, 0, 4);
}
}
@@ -366,7 +370,8 @@ void NormalOpenGLGraphics::drawImageInline(const Image *restrict const image,
setColorAlpha(image->mAlpha);
#ifdef DEBUG_BIND_TEXTURE
debugBindTexture(image);
-#endif
+#endif // DEBUG_BIND_TEXTURE
+
bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage);
setTexturingAndBlending(true);
@@ -404,7 +409,8 @@ void NormalOpenGLGraphics::testDraw() restrict2
bindPointerIntFloat(&vert[0], &tex[0]);
#ifdef DEBUG_DRAW_CALLS
NormalOpenGLGraphics::mDrawCalls ++;
-#endif
+#endif // DEBUG_DRAW_CALLS
+
glDrawArrays(GL_QUADS, 0, 4);
}
else
@@ -428,7 +434,8 @@ void NormalOpenGLGraphics::testDraw() restrict2
bindPointerInt(&vert[0], &tex[0]);
#ifdef DEBUG_DRAW_CALLS
NormalOpenGLGraphics::mDrawCalls ++;
-#endif
+#endif // DEBUG_DRAW_CALLS
+
glDrawArrays(GL_QUADS, 0, 4);
}
}
@@ -600,7 +607,8 @@ void NormalOpenGLGraphics::completeCache() restrict2
setColorAlpha(mAlphaCached);
#ifdef DEBUG_BIND_TEXTURE
debugBindTexture(image);
-#endif
+#endif // DEBUG_BIND_TEXTURE
+
bindTexture(OpenGLImageHelper::mTextureType, mImageCached);
setTexturingAndBlending(true);
@@ -634,7 +642,8 @@ void NormalOpenGLGraphics::drawRescaledImage(const Image *restrict const image,
setColorAlpha(image->mAlpha);
#ifdef DEBUG_BIND_TEXTURE
debugBindTexture(image);
-#endif
+#endif // DEBUG_BIND_TEXTURE
+
bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage);
setTexturingAndBlending(true);
@@ -676,7 +685,8 @@ void NormalOpenGLGraphics::drawPatternInline(const Image *restrict const image,
#ifdef DEBUG_BIND_TEXTURE
debugBindTexture(image);
-#endif
+#endif // DEBUG_BIND_TEXTURE
+
bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage);
setTexturingAndBlending(true);
@@ -769,7 +779,8 @@ void NormalOpenGLGraphics::drawRescaledPattern(const Image *
#ifdef DEBUG_BIND_TEXTURE
debugBindTexture(image);
-#endif
+#endif // DEBUG_BIND_TEXTURE
+
bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage);
setTexturingAndBlending(true);
@@ -1060,7 +1071,8 @@ void NormalOpenGLGraphics::drawTileCollection(const ImageCollection
setColorAlpha(image->mAlpha);
#ifdef DEBUG_BIND_TEXTURE
debugBindTexture(image);
-#endif
+#endif // DEBUG_BIND_TEXTURE
+
bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage);
setTexturingAndBlending(true);
drawVertexes(vert->ogl);
@@ -1182,7 +1194,8 @@ void NormalOpenGLGraphics::drawTileVertexes(const ImageVertexes *
setColorAlpha(image->mAlpha);
#ifdef DEBUG_BIND_TEXTURE
debugBindTexture(image);
-#endif
+#endif // DEBUG_BIND_TEXTURE
+
bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage);
setTexturingAndBlending(true);
drawVertexes(vert->ogl);
@@ -1221,20 +1234,21 @@ void NormalOpenGLGraphics::updateScreen() restrict2
#ifdef DEBUG_DRAW_CALLS
mLastDrawCalls = mDrawCalls;
mDrawCalls = 0;
-#endif
+#endif // DEBUG_DRAW_CALLS
#ifdef DEBUG_BIND_TEXTURE
mLastBinds = mBinds;
mBinds = 0;
-#endif
+#endif // DEBUG_BIND_TEXTURE
#ifdef USE_SDL2
SDL_GL_SwapWindow(mWindow);
-#else
+#else // USE_SDL2
SDL_GL_SwapBuffers();
-#endif
+#endif // USE_SDL2
#ifdef DEBUG_OPENGL
if (isGLNotNull(mglFrameTerminator))
mglFrameTerminator();
-#endif
+#endif // DEBUG_OPENGL
+
// may be need clear?
// glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
BLOCK_END("Graphics::updateScreen")
@@ -1255,11 +1269,12 @@ void NormalOpenGLGraphics::beginDraw() restrict2
glOrthof(0.0, static_cast<float>(w),
static_cast<float>(h),
0.0, -1.0, 1.0);
-#else
+#else // ANDROID
+
glOrtho(0.0, static_cast<double>(w),
static_cast<double>(h),
0.0, -1.0, 1.0);
-#endif
+#endif // ANDROID
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
@@ -1281,7 +1296,7 @@ void NormalOpenGLGraphics::beginDraw() restrict2
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
glHint(GL_POINT_SMOOTH_HINT, GL_FASTEST);
glHint(GL_POLYGON_SMOOTH_HINT, GL_FASTEST);
-#endif
+#endif // ANDROID
pushClipArea(Rect(0, 0, w, h));
}
@@ -1355,11 +1370,12 @@ void NormalOpenGLGraphics::drawPoint(int x, int y) restrict2
#ifdef ANDROID
// TODO need fix
-#else
+#else // ANDROID
+
glBegin(GL_POINTS);
glVertex2i(x, y);
glEnd();
-#endif
+#endif // ANDROID
}
void NormalOpenGLGraphics::drawLine(int x1, int y1,
@@ -1450,8 +1466,9 @@ void NormalOpenGLGraphics::drawRectangle(const Rect &restrict rect,
glVertexPointer(2, GL_FLOAT, 0, &vert);
vertPtr = nullptr;
#ifdef DEBUG_DRAW_CALLS
- mDrawCalls ++;
-#endif
+ mDrawCalls ++;
+#endif // DEBUG_DRAW_CALLS
+
glDrawArrays(filled ? GL_QUADS : GL_LINE_LOOP, 0, 4);
BLOCK_END("Graphics::drawRectangle")
}
@@ -1516,7 +1533,7 @@ void NormalOpenGLGraphics::bindTexture(const GLenum target,
glBindTexture(target, texture);
#ifdef DEBUG_BIND_TEXTURE
mBinds ++;
-#endif
+#endif // DEBUG_BIND_TEXTURE
}
}
@@ -1525,7 +1542,8 @@ inline void NormalOpenGLGraphics::drawQuadArrayfi(const int size) restrict2
bindPointerIntFloat(&mIntVertArray[0], &mFloatTexArray[0]);
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
-#endif
+#endif // DEBUG_DRAW_CALLS
+
glDrawArrays(GL_QUADS, 0, size / 2);
}
@@ -1535,7 +1553,8 @@ inline void NormalOpenGLGraphics::drawQuadArrayfiCached(const int size)
bindPointerIntFloat(&mIntVertArrayCached[0], &mFloatTexArrayCached[0]);
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
-#endif
+#endif // DEBUG_DRAW_CALLS
+
glDrawArrays(GL_QUADS, 0, size / 2);
}
@@ -1550,7 +1569,8 @@ inline void NormalOpenGLGraphics::drawQuadArrayfi(const GLint *restrict const
glTexCoordPointer(2, GL_FLOAT, 0, floatTexArray);
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
-#endif
+#endif // DEBUG_DRAW_CALLS
+
glDrawArrays(GL_QUADS, 0, size / 2);
}
@@ -1559,7 +1579,8 @@ inline void NormalOpenGLGraphics::drawQuadArrayii(const int size) restrict2
bindPointerInt(&mIntVertArray[0], &mIntTexArray[0]);
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
-#endif
+#endif // DEBUG_DRAW_CALLS
+
glDrawArrays(GL_QUADS, 0, size / 2);
}
@@ -1569,7 +1590,8 @@ inline void NormalOpenGLGraphics::drawQuadArrayiiCached(const int size)
bindPointerInt(&mIntVertArrayCached[0], &mIntTexArrayCached[0]);
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
-#endif
+#endif // DEBUG_DRAW_CALLS
+
glDrawArrays(GL_QUADS, 0, size / 2);
}
@@ -1584,7 +1606,8 @@ inline void NormalOpenGLGraphics::drawQuadArrayii(const GLint *restrict const
glTexCoordPointer(2, GL_INT, 0, intTexArray);
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
-#endif
+#endif // DEBUG_DRAW_CALLS
+
glDrawArrays(GL_QUADS, 0, size / 2);
}
@@ -1594,7 +1617,8 @@ inline void NormalOpenGLGraphics::drawLineArrayi(const int size) restrict2
vertPtr = nullptr;
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
-#endif
+#endif // DEBUG_DRAW_CALLS
+
glDrawArrays(GL_LINES, 0, size / 2);
}
@@ -1604,7 +1628,8 @@ inline void NormalOpenGLGraphics::drawLineArrayf(const int size) restrict2
vertPtr = nullptr;
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
-#endif
+#endif // DEBUG_DRAW_CALLS
+
glDrawArrays(GL_LINES, 0, size / 2);
}
@@ -1690,12 +1715,13 @@ void NormalOpenGLGraphics::debugBindTexture(const Image *restrict const image)
mOldTexture = texture;
}
}
-#else
+#else // DEBUG_BIND_TEXTURE
+
void NormalOpenGLGraphics::debugBindTexture(const Image *restrict const
image A_UNUSED) restrict2
{
}
-#endif
+#endif // DEBUG_BIND_TEXTURE
#endif // defined(USE_OPENGL) && !defined(ANDROID) &&
// !defined(__native_client__)
diff --git a/src/render/normalopenglgraphics.h b/src/render/normalopenglgraphics.h
index 187ca7d2d..170542abb 100644
--- a/src/render/normalopenglgraphics.h
+++ b/src/render/normalopenglgraphics.h
@@ -35,17 +35,17 @@
#include <GLES/gl.h>
#include <GLES/glext.h>
#include <GLES2/gl2.h>
-#else
+#else // ANDROID
#ifndef USE_SDL2
#define GL_GLEXT_PROTOTYPES 1
-#endif
+#endif // USE_SDL2
#include <SDL_opengl.h>
#if defined(__APPLE__)
#include <OpenGL/glext.h>
#elif !defined(__native_client__)
#include <GL/glext.h>
#endif // defined(__APPLE__)
-#endif
+#endif // ANDROID
class OpenGLGraphicsVertexes;
@@ -96,7 +96,7 @@ class NormalOpenGLGraphics final : public Graphics
#ifdef DEBUG_BIND_TEXTURE
unsigned int getBinds() const restrict2 noexcept2
{ return mLastBinds; }
-#endif
+#endif // DEBUG_BIND_TEXTURE
private:
GLfloat *mFloatTexArray A_NONNULLPOINTER;
@@ -120,9 +120,11 @@ class NormalOpenGLGraphics final : public Graphics
unsigned int mOldTextureId;
static unsigned int mBinds;
static unsigned int mLastBinds;
-#endif
+#endif // DEBUG_BIND_TEXTURE
+
FBOInfo mFbo;
};
-#endif
+#endif // defined USE_OPENGL && !defined ANDROID &&
+ // !defined(__native_client__)
#endif // RENDER_NORMALOPENGLGRAPHICS_H
diff --git a/src/render/nullopenglgraphics.cpp b/src/render/nullopenglgraphics.cpp
index ad37f70f7..a39ce8518 100644
--- a/src/render/nullopenglgraphics.cpp
+++ b/src/render/nullopenglgraphics.cpp
@@ -26,7 +26,7 @@
#ifdef DEBUG_BIND_TEXTURE
#include "logger.h"
-#endif
+#endif // DEBUG_BIND_TEXTURE
#include "render/vertexes/imagecollection.h"
@@ -41,7 +41,7 @@ GLuint NullOpenGLGraphics::mTextureBinded = 0;
#ifdef DEBUG_DRAW_CALLS
unsigned int NullOpenGLGraphics::mDrawCalls = 0;
unsigned int NullOpenGLGraphics::mLastDrawCalls = 0;
-#endif
+#endif // DEBUG_DRAW_CALLS
NullOpenGLGraphics::NullOpenGLGraphics() :
mFloatTexArray(nullptr),
@@ -56,7 +56,7 @@ NullOpenGLGraphics::NullOpenGLGraphics() :
#ifdef DEBUG_BIND_TEXTURE
mOldTexture(),
mOldTextureId(0),
-#endif
+#endif // DEBUG_BIND_TEXTURE
mFbo()
{
mOpenGL = RENDER_NULL;
@@ -122,13 +122,13 @@ static inline void drawQuad(const Image *restrict const image A_UNUSED,
{
#ifdef DEBUG_DRAW_CALLS
NullOpenGLGraphics::mDrawCalls ++;
-#endif
+#endif // DEBUG_DRAW_CALLS
}
else
{
#ifdef DEBUG_DRAW_CALLS
NullOpenGLGraphics::mDrawCalls ++;
-#endif
+#endif // DEBUG_DRAW_CALLS
}
}
@@ -146,13 +146,13 @@ static inline void drawRescaledQuad(const Image *restrict const image A_UNUSED,
{
#ifdef DEBUG_DRAW_CALLS
NullOpenGLGraphics::mDrawCalls ++;
-#endif
+#endif // DEBUG_DRAW_CALLS
}
else
{
#ifdef DEBUG_DRAW_CALLS
NullOpenGLGraphics::mDrawCalls ++;
-#endif
+#endif // DEBUG_DRAW_CALLS
}
}
@@ -178,7 +178,8 @@ void NullOpenGLGraphics::drawImageInline(const Image *restrict const image,
setColorAlpha(image->mAlpha);
#ifdef DEBUG_BIND_TEXTURE
debugBindTexture(image);
-#endif
+#endif // DEBUG_BIND_TEXTURE
+
bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage);
setTexturingAndBlending(true);
@@ -228,7 +229,8 @@ void NullOpenGLGraphics::drawRescaledImage(const Image *restrict const image,
setColorAlpha(image->mAlpha);
#ifdef DEBUG_BIND_TEXTURE
debugBindTexture(image);
-#endif
+#endif // DEBUG_BIND_TEXTURE
+
bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage);
setTexturingAndBlending(true);
@@ -268,7 +270,8 @@ void NullOpenGLGraphics::drawPatternInline(const Image *restrict const image,
#ifdef DEBUG_BIND_TEXTURE
debugBindTexture(image);
-#endif
+#endif // DEBUG_BIND_TEXTURE
+
bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage);
setTexturingAndBlending(true);
@@ -401,7 +404,8 @@ void NullOpenGLGraphics::drawRescaledPattern(const Image *restrict const image,
#ifdef DEBUG_BIND_TEXTURE
debugBindTexture(image);
-#endif
+#endif // DEBUG_BIND_TEXTURE
+
bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage);
setTexturingAndBlending(true);
@@ -748,7 +752,8 @@ void NullOpenGLGraphics::drawTileCollection(const ImageCollection
setColorAlpha(image->mAlpha);
#ifdef DEBUG_BIND_TEXTURE
debugBindTexture(image);
-#endif
+#endif // DEBUG_BIND_TEXTURE
+
bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage);
setTexturingAndBlending(true);
drawVertexes(vert->ogl);
@@ -909,7 +914,8 @@ void NullOpenGLGraphics::drawTileVertexes(const ImageVertexes *
setColorAlpha(image->mAlpha);
#ifdef DEBUG_BIND_TEXTURE
debugBindTexture(image);
-#endif
+#endif // DEBUG_BIND_TEXTURE
+
bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage);
setTexturingAndBlending(true);
drawVertexes(vert->ogl);
@@ -946,7 +952,8 @@ void NullOpenGLGraphics::updateScreen() restrict2
#ifdef DEBUG_DRAW_CALLS
mLastDrawCalls = mDrawCalls;
mDrawCalls = 0;
-#endif
+#endif // DEBUG_DRAW_CALLS
+
BLOCK_END("Graphics::updateScreen")
}
@@ -1049,7 +1056,8 @@ void NullOpenGLGraphics::drawRectangle(const Rect &restrict rect A_UNUSED,
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
-#endif
+#endif // DEBUG_DRAW_CALLS
+
BLOCK_END("Graphics::drawRectangle")
}
@@ -1116,7 +1124,7 @@ inline void NullOpenGLGraphics::drawQuadArrayfi(const int size A_UNUSED)
{
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
-#endif
+#endif // DEBUG_DRAW_CALLS
}
inline void NullOpenGLGraphics::drawQuadArrayfi(const GLint *restrict const
@@ -1128,7 +1136,7 @@ inline void NullOpenGLGraphics::drawQuadArrayfi(const GLint *restrict const
{
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
-#endif
+#endif // DEBUG_DRAW_CALLS
}
inline void NullOpenGLGraphics::drawQuadArrayii(const int size A_UNUSED)
@@ -1136,7 +1144,7 @@ inline void NullOpenGLGraphics::drawQuadArrayii(const int size A_UNUSED)
{
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
-#endif
+#endif // DEBUG_DRAW_CALLS
}
inline void NullOpenGLGraphics::drawQuadArrayii(const GLint *restrict const
@@ -1148,7 +1156,7 @@ inline void NullOpenGLGraphics::drawQuadArrayii(const GLint *restrict const
{
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
-#endif
+#endif // DEBUG_DRAW_CALLS
}
inline void NullOpenGLGraphics::drawLineArrayi(const int size A_UNUSED)
@@ -1156,7 +1164,7 @@ inline void NullOpenGLGraphics::drawLineArrayi(const int size A_UNUSED)
{
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
-#endif
+#endif // DEBUG_DRAW_CALLS
}
inline void NullOpenGLGraphics::drawLineArrayf(const int size A_UNUSED)
@@ -1164,7 +1172,7 @@ inline void NullOpenGLGraphics::drawLineArrayf(const int size A_UNUSED)
{
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
-#endif
+#endif // DEBUG_DRAW_CALLS
}
void NullOpenGLGraphics::dumpSettings()
@@ -1227,11 +1235,11 @@ void NullOpenGLGraphics::debugBindTexture(const Image *restrict const image)
mOldTexture = texture;
}
}
-#else
+#else // DEBUG_BIND_TEXTURE
+
void NullOpenGLGraphics::debugBindTexture(const Image *restrict const
image A_UNUSED) restrict2
{
}
-#endif
-
+#endif // DEBUG_BIND_TEXTURE
#endif // USE_OPENGL
diff --git a/src/render/nullopenglgraphics.h b/src/render/nullopenglgraphics.h
index 920ee8fcc..62a157cd3 100644
--- a/src/render/nullopenglgraphics.h
+++ b/src/render/nullopenglgraphics.h
@@ -35,17 +35,17 @@
#include <GLES/gl.h>
#include <GLES/glext.h>
#include <GLES2/gl2.h>
-#else
+#else // ANDROID
#ifndef USE_SDL2
#define GL_GLEXT_PROTOTYPES 1
-#endif
+#endif // USE_SDL2
#include <SDL_opengl.h>
#if defined(__APPLE__)
#include <OpenGL/glext.h>
#elif !defined(__native_client__)
#include <GL/glext.h>
#endif // defined(__APPLE__)
-#endif
+#endif // ANDROID
class OpenGLGraphicsVertexes;
@@ -101,9 +101,8 @@ class NullOpenGLGraphics final : public Graphics
#ifdef DEBUG_BIND_TEXTURE
std::string mOldTexture;
unsigned mOldTextureId;
-#endif
+#endif // DEBUG_BIND_TEXTURE
FBOInfo mFbo;
};
-#endif
-
+#endif // defined USE_OPENGL
#endif // RENDER_NULLOPENGLGRAPHICS_H
diff --git a/src/render/opengl/mgl.cpp b/src/render/opengl/mgl.cpp
index cdcd5808b..11c4ca462 100644
--- a/src/render/opengl/mgl.cpp
+++ b/src/render/opengl/mgl.cpp
@@ -31,4 +31,4 @@
MGL_DEFINE
-#endif
+#endif // USE_OPENGL
diff --git a/src/render/opengl/mgldefines.h b/src/render/opengl/mgldefines.h
index 05d4bafcc..84b12da26 100644
--- a/src/render/opengl/mgldefines.h
+++ b/src/render/opengl/mgldefines.h
@@ -29,17 +29,17 @@
#define GL_COLOR_ATTACHMENT0 0x8CE0
#define GL_FRAMEBUFFER 0x8D40
#define GL_RENDERBUFFER 0x8D41
-#endif
+#endif // GL_NUM_EXTENSIONS
#ifndef GL_COMPRESSED_RGBA_ARB
#define GL_COMPRESSED_RGBA_ARB 0x84EE
#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3
#define GL_COMPRESSED_RGBA_FXT1_3DFX 0x86B1
-#endif
+#endif // GL_COMPRESSED_RGBA_ARB
#ifndef GL_MAX_ELEMENTS_VERTICES
#define GL_MAX_ELEMENTS_VERTICES 0x80E8
#define GL_MAX_ELEMENTS_INDICES 0x80E9
-#endif
+#endif // GL_MAX_ELEMENTS_VERTICES
#ifndef GL_DEBUG_OUTPUT
#define GL_DEBUG_OUTPUT_SYNCHRONOUS 0x8242
@@ -61,14 +61,14 @@
#define GL_DEBUG_SEVERITY_HIGH 0x9146
#define GL_DEBUG_SEVERITY_MEDIUM 0x9147
#define GL_DEBUG_SEVERITY_LOW 0x9148
-#endif
+#endif // GL_DEBUG_OUTPUT
#ifndef GL_DEBUG_TYPE_PUSH_GROUP
#define GL_DEBUG_TYPE_PUSH_GROUP 0x8269
-#endif
+#endif // GL_DEBUG_TYPE_PUSH_GROUP
#ifndef GL_DEBUG_TYPE_POP_GROUP
#define GL_DEBUG_TYPE_POP_GROUP 0x826a
-#endif
+#endif // GL_DEBUG_TYPE_POP_GROUP
#ifndef GL_EXT_debug_label
#define GL_PROGRAM_PIPELINE_OBJECT_EXT 0x8A4F
@@ -77,18 +77,18 @@
#define GL_BUFFER_OBJECT_EXT 0x9151
#define GL_QUERY_OBJECT_EXT 0x9153
#define GL_VERTEX_ARRAY_OBJECT_EXT 0x9154
-#endif
+#endif // GL_EXT_debug_label
#ifndef GL_ARRAY_BUFFER
#define GL_ARRAY_BUFFER 0x8892
#define GL_ELEMENT_ARRAY_BUFFER 0x8893
-#endif
+#endif // GL_ARRAY_BUFFER
#ifndef GL_STREAM_DRAW
#define GL_STREAM_DRAW 0x88E0
#define GL_STATIC_DRAW 0x88E4
#define GL_DYNAMIC_DRAW 0x88E8
-#endif
+#endif // GL_STREAM_DRAW
#ifndef GL_COMPILE_STATUS
#define GL_FRAGMENT_SHADER 0x8B30
@@ -97,39 +97,39 @@
#define GL_LINK_STATUS 0x8B82
#define GL_VALIDATE_STATUS 0x8B83
#define GL_INFO_LOG_LENGTH 0x8B84
-#endif
+#endif // GL_COMPILE_STATUS
#ifndef GL_DEPTH_CLAMP
#define GL_DEPTH_CLAMP 0x864F
#define GL_RASTERIZER_DISCARD 0x8C89
#define GL_SAMPLE_MASK 0x8E51
-#endif
+#endif // GL_DEPTH_CLAMP
#ifndef GL_POLYGON_SMOOTH
#define GL_POLYGON_SMOOTH 0x0B41
-#endif
+#endif // GL_POLYGON_SMOOTH
#ifndef GL_DEPTH_BOUNDS_TEST_EXT
#define GL_DEPTH_BOUNDS_TEST_EXT 0x8890
-#endif
+#endif // GL_DEPTH_BOUNDS_TEST_EXT
#ifndef GL_TEXTURE_COMPRESSION_HINT_ARB
#define GL_TEXTURE_COMPRESSION_HINT_ARB 0x84EF
-#endif
+#endif // GL_TEXTURE_COMPRESSION_HINT_ARB
#ifndef GLX_CONTEXT_PROFILE_MASK_ARB
#define GLX_CONTEXT_PROFILE_MASK_ARB 0x9126
-#endif
+#endif // GLX_CONTEXT_PROFILE_MASK_ARB
#ifndef GLX_CONTEXT_MAJOR_VERSION_ARB
#define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091
#define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092
#define GLX_CONTEXT_FLAGS_ARB 0x2094
-#endif
+#endif // GLX_CONTEXT_MAJOR_VERSION_ARB
#ifndef GL_COMPRESSED_RGBA_BPTC_UNORM_ARB
#define GL_COMPRESSED_RGBA_BPTC_UNORM_ARB 0x8E8C
-#endif
+#endif // GL_COMPRESSED_RGBA_BPTC_UNORM_ARB
#endif // USE_OPENGL
diff --git a/src/render/opengl/mglemu.cpp b/src/render/opengl/mglemu.cpp
index 297dae3e1..669f7952f 100644
--- a/src/render/opengl/mglemu.cpp
+++ b/src/render/opengl/mglemu.cpp
@@ -44,4 +44,4 @@ void APIENTRY emuglActiveTexture(GLenum texture A_UNUSED)
{
}
-#endif
+#endif // USE_OPENGL
diff --git a/src/render/opengl/mglfunctions.h b/src/render/opengl/mglfunctions.h
index de445c06b..a8009f899 100644
--- a/src/render/opengl/mglfunctions.h
+++ b/src/render/opengl/mglfunctions.h
@@ -35,10 +35,10 @@ LOGGER_H
#define getFunction(name) nullptr
#elif defined __native_client__
#define getFunction(name) glGetProcAddressREGAL(name)
-#else
+#else // WIN32
#define getFunction(name) glXGetProcAddress(\
reinterpret_cast<const GLubyte*>(name))
-#endif
+#endif // WIN32
#define assignFunction(func) \
{ \
diff --git a/src/render/opengl/mgltypes.h b/src/render/opengl/mgltypes.h
index dcd1290d1..828b862ce 100644
--- a/src/render/opengl/mgltypes.h
+++ b/src/render/opengl/mgltypes.h
@@ -27,14 +27,14 @@
#include <GLES/gl.h>
#include <GLES/glext.h>
#define APIENTRY GL_APIENTRY
-#else
+#else // ANDROID
#ifndef USE_SDL2
#define GL_GLEXT_PROTOTYPES 1
-#endif
+#endif // USE_SDL2
#include <SDL_opengl.h>
#ifdef __native_client__
#include <GL/Regal.h>
-#else
+#else // __native_client__
#if defined(__APPLE__)
#include <OpenGL/glext.h>
#else // defined(__APPLE__)
@@ -44,8 +44,8 @@
#error missing include <GL/glext.h>
#endif // __glext_h_
#endif // defined(__APPLE__)
-#endif
-#endif
+#endif // __native_client__
+#endif // ANDROID
#include "render/opengl/mgldefines.h"
RENDER_OPENGL_MGLDEFINES_H
@@ -142,7 +142,8 @@ typedef void (APIENTRY *glGetProgramInfoLog_t) (GLuint program,
typedef void (APIENTRY *glBindAttribLocation_t) (GLuint program,
GLuint index, const GLchar *name);
typedef void (APIENTRY *glActiveTexture_t) (GLenum texture);
-#endif
+#endif // __native_client__
+
typedef GLint (APIENTRY *glGetAttribLocation_t) (GLuint program,
const GLchar *name);
typedef void (APIENTRY *glUniform3f_t) (GLint location,
@@ -215,9 +216,9 @@ typedef void (APIENTRY *glDebugMessageCallback_t) (GLDEBUGPROC_t callback,
#ifdef WIN32
typedef const char* (APIENTRY * wglGetExtensionsString_t) (HDC hdc);
-#else
+#else // WIN32
#define CALLBACK
-#endif
+#endif // WIN32
#endif // USE_OPENGL
#endif // RENDER_OPENGL_MGLTYPES_H
diff --git a/src/render/opengl/opengldebug.h b/src/render/opengl/opengldebug.h
index 8d2f19e18..ebd449795 100644
--- a/src/render/opengl/opengldebug.h
+++ b/src/render/opengl/opengldebug.h
@@ -30,9 +30,9 @@ RENDER_OPENGL_MGL_H
mglPushGroupMarker(sizeof(text), text);
#define GLDEBUG_END() if (mglPopGroupMarker) \
mglPopGroupMarker();
-#else
+#else // defined(DEBUG_OPENGL) && defined(USE_OPENGL)
#define GLDEBUG_START(text)
#define GLDEBUG_END()
-#endif
+#endif // defined(DEBUG_OPENGL) && defined(USE_OPENGL)
#endif // RENDER_OPENGL_OPENGLDEBUG_H
diff --git a/src/render/openglx/mglx.cpp b/src/render/openglx/mglx.cpp
index 4fdc85838..73b00082b 100644
--- a/src/render/openglx/mglx.cpp
+++ b/src/render/openglx/mglx.cpp
@@ -31,4 +31,4 @@
MGLX_DEFINE
-#endif
+#endif // defined(USE_OPENGL) && defined(USE_X11)
diff --git a/src/render/openglx/mglxinit.cpp b/src/render/openglx/mglxinit.cpp
index 78a20ebf0..ffe2c5f2f 100644
--- a/src/render/openglx/mglxinit.cpp
+++ b/src/render/openglx/mglxinit.cpp
@@ -39,4 +39,4 @@ void Glx::initFunctions()
assignFunction(glXSwapBuffers);
}
-#endif
+#endif // defined(USE_OPENGL) && defined(USE_X11)
diff --git a/src/render/renderers.cpp b/src/render/renderers.cpp
index a11c438d1..ac5cc71d9 100644
--- a/src/render/renderers.cpp
+++ b/src/render/renderers.cpp
@@ -29,12 +29,14 @@ static RenderType getDefault() noexcept2
#ifdef USE_OPENGL
#ifdef ANDROID
return RENDER_GLES_OPENGL;
-#else
+#else // ANDROID
+
return RENDER_NORMAL_OPENGL;
-#endif
-#else
+#endif // ANDROID
+#else // USE_OPENGL
+
return RENDER_SOFTWARE;
-#endif
+#endif // USE_OPENGL
}
RenderType intToRenderType(const int mode) noexcept2
diff --git a/src/render/safeopenglgraphics.cpp b/src/render/safeopenglgraphics.cpp
index 50364590d..6ddb33ebc 100644
--- a/src/render/safeopenglgraphics.cpp
+++ b/src/render/safeopenglgraphics.cpp
@@ -493,11 +493,12 @@ void SafeOpenGLGraphics::updateScreen() restrict2
SDL_GL_SwapWindow(mWindow);
#else
SDL_GL_SwapBuffers();
-#endif
+#endif // USE_SDL2
#ifdef DEBUG_OPENGL
if (isGLNotNull(mglFrameTerminator))
mglFrameTerminator();
-#endif
+#endif // DEBUG_OPENGL
+
BLOCK_END("Graphics::updateScreen")
}
diff --git a/src/render/safeopenglgraphics.h b/src/render/safeopenglgraphics.h
index 1805730fa..e311333a2 100644
--- a/src/render/safeopenglgraphics.h
+++ b/src/render/safeopenglgraphics.h
@@ -32,17 +32,17 @@
#ifdef ANDROID
#include <GLES/gl.h>
#include <GLES/glext.h>
-#else
+#else // ANDROID
#ifndef USE_SDL2
#define GL_GLEXT_PROTOTYPES 1
-#endif
+#endif // USE_SDL2
#include <SDL_opengl.h>
#if defined(__APPLE__)
#include <OpenGL/glext.h>
#elif !defined(__native_client__)
#include <GL/glext.h>
#endif // defined(__APPLE__)
-#endif
+#endif // ANDROID
class SafeOpenGLGraphics final : public Graphics
{
@@ -72,6 +72,6 @@ class SafeOpenGLGraphics final : public Graphics
bool mColorAlpha;
FBOInfo mFbo;
};
-#endif
+#endif // defined USE_OPENGL && !defined ANDROID
#endif // RENDER_SAFEOPENGLGRAPHICS_H
diff --git a/src/render/sdl2graphics.cpp b/src/render/sdl2graphics.cpp
index ce6250c7b..701b96001 100644
--- a/src/render/sdl2graphics.cpp
+++ b/src/render/sdl2graphics.cpp
@@ -99,12 +99,12 @@ static int FakeSDL_RenderCopy(SDL_Renderer *restrict const renderer,
return ret;
}
-#else
+#else // DEBUG_SDL_SURFACES
#define MSDL_RenderCopy(render, texture, src, dst) \
SDL_RenderCopy(render, texture, src, dst)
-#endif
+#endif // DEBUG_SDL_SURFACES
#define setRenderDrawColor(mColor) \
SDL_SetRenderDrawColor(mRenderer, \
diff --git a/src/render/sdl2softwaregraphics.cpp b/src/render/sdl2softwaregraphics.cpp
index 2d0ade4d9..d60d70cc8 100644
--- a/src/render/sdl2softwaregraphics.cpp
+++ b/src/render/sdl2softwaregraphics.cpp
@@ -41,13 +41,13 @@
#ifndef SDL_BYTEORDER
#error missing SDL_endian.h
-#endif
+#endif // SDL_BYTEORDER
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
static unsigned int *cR = nullptr;
static unsigned int *cG = nullptr;
static unsigned int *cB = nullptr;
-#endif
+#endif // SDL_BYTEORDER == SDL_LIL_ENDIAN
#define defRectFromArea(rect, area) \
const SDL_Rect rect = \
@@ -995,11 +995,12 @@ void SDL2SoftwareGraphics::fillRectangle(const Rect &restrict rectangle)
p[2] = CAST_U8((p[2] * ca + cb) >> 8);
p[1] = CAST_U8((p[1] * ca + cg) >> 8);
p[0] = CAST_U8((p[0] * ca + cr) >> 8);
-#else
+#else // SDL_BYTEORDER == SDL_BIG_ENDIAN
+
p[0] = CAST_U8((p[0] * ca + cb) >> 8);
p[1] = CAST_U8((p[1] * ca + cg) >> 8);
p[2] = CAST_U8((p[2] * ca + cr) >> 8);
-#endif
+#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN
}
}
break;
@@ -1029,7 +1030,8 @@ void SDL2SoftwareGraphics::fillRectangle(const Rect &restrict rectangle)
| (g & 0xff00) | (r & 0xff0000));
}
}
-#else
+#else // SDL_BYTEORDER == SDL_BIG_ENDIAN
+
if (!cR)
{
cR = new unsigned int[0x100];
@@ -1089,7 +1091,8 @@ void SDL2SoftwareGraphics::fillRectangle(const Rect &restrict rectangle)
| cR[(dst & rMask) / rShift];
}
}
-#endif
+#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN
+
break;
}
default:
@@ -1241,7 +1244,8 @@ void SDL2SoftwareGraphics::drawHLine(int x1, int y, int x2) restrict2
p[2] = b2;
p += 3;
}
-#else
+#else // SDL_BYTEORDER == SDL_BIG_ENDIAN
+
for (; x1 <= x2; ++x1)
{
p[0] = b2;
@@ -1249,7 +1253,8 @@ void SDL2SoftwareGraphics::drawHLine(int x1, int y, int x2) restrict2
p[2] = b0;
p += 3;
}
-#endif
+#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN
+
break;
}
@@ -1371,7 +1376,8 @@ void SDL2SoftwareGraphics::drawVLine(int x, int y1, int y2) restrict2
p[2] = b2;
p += pitch;
}
-#else
+#else // SDL_BYTEORDER == SDL_BIG_ENDIAN
+
for (; y1 <= y2; ++y1)
{
p[0] = b2;
@@ -1379,7 +1385,8 @@ void SDL2SoftwareGraphics::drawVLine(int x, int y1, int y2) restrict2
p[2] = b0;
p += pitch;
}
-#endif
+#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN
+
break;
}
diff --git a/src/render/sdlgraphics.cpp b/src/render/sdlgraphics.cpp
index 9cd734f30..c0e9b58a3 100644
--- a/src/render/sdlgraphics.cpp
+++ b/src/render/sdlgraphics.cpp
@@ -40,13 +40,13 @@
#ifndef SDL_BYTEORDER
#error missing SDL_endian.h
-#endif
+#endif // SDL_BYTEORDER
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
static unsigned int *cR = nullptr;
static unsigned int *cG = nullptr;
static unsigned int *cB = nullptr;
-#endif
+#endif // SDL_BYTEORDER == SDL_LIL_ENDIAN
SDLGraphics::SDLGraphics() :
Graphics(),
@@ -970,11 +970,11 @@ void SDLGraphics::fillRectangle(const Rect &restrict rectangle) restrict2
p[2] = CAST_U8((p[2] * ca + cb) >> 8);
p[1] = CAST_U8((p[1] * ca + cg) >> 8);
p[0] = CAST_U8((p[0] * ca + cr) >> 8);
-#else
+#else // SDL_BYTEORDER == SDL_BIG_ENDIAN
p[0] = CAST_U8((p[0] * ca + cb) >> 8);
p[1] = CAST_U8((p[1] * ca + cg) >> 8);
p[2] = CAST_U8((p[2] * ca + cr) >> 8);
-#endif
+#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN
}
}
break;
@@ -1004,7 +1004,7 @@ void SDLGraphics::fillRectangle(const Rect &restrict rectangle) restrict2
| (g & 0xff00) | (r & 0xff0000));
}
}
-#else
+#else // SDL_BYTEORDER == SDL_BIG_ENDIAN
if (!cR)
{
cR = new unsigned int[0x100];
@@ -1064,7 +1064,7 @@ void SDLGraphics::fillRectangle(const Rect &restrict rectangle) restrict2
| cR[(dst & rMask) / rShift];
}
}
-#endif
+#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN
break;
}
default:
@@ -1235,7 +1235,7 @@ void SDLGraphics::drawHLine(int x1, int y, int x2) restrict2
p[2] = b2;
p += 3;
}
-#else
+#else // SDL_BYTEORDER == SDL_BIG_ENDIAN
for (; x1 <= x2; ++x1)
{
p[0] = b2;
@@ -1243,7 +1243,7 @@ void SDLGraphics::drawHLine(int x1, int y, int x2) restrict2
p[2] = b0;
p += 3;
}
-#endif
+#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN
break;
}
@@ -1365,7 +1365,7 @@ void SDLGraphics::drawVLine(int x, int y1, int y2) restrict2
p[2] = b2;
p += pitch;
}
-#else
+#else // SDL_BYTEORDER == SDL_BIG_ENDIAN
for (; y1 <= y2; ++y1)
{
p[0] = b2;
@@ -1373,7 +1373,7 @@ void SDLGraphics::drawVLine(int x, int y1, int y2) restrict2
p[2] = b0;
p += pitch;
}
-#endif
+#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN
break;
}
diff --git a/src/render/shaders/shaderprogram.cpp b/src/render/shaders/shaderprogram.cpp
index e334b4a7e..f62f3bbc0 100644
--- a/src/render/shaders/shaderprogram.cpp
+++ b/src/render/shaders/shaderprogram.cpp
@@ -25,7 +25,7 @@
#include "render/opengl/mgl.h"
#ifdef __native_client__
#include "render/opengl/naclglfunctions.h"
-#endif
+#endif // __native_client__
#include "render/shaders/shader.h"
diff --git a/src/render/shaders/shadersmanager.cpp b/src/render/shaders/shadersmanager.cpp
index cf7dd81d9..96f4c3738 100644
--- a/src/render/shaders/shadersmanager.cpp
+++ b/src/render/shaders/shadersmanager.cpp
@@ -28,7 +28,7 @@
#include "render/opengl/mgl.h"
#ifdef __native_client__
#include "render/opengl/naclglfunctions.h"
-#endif
+#endif // __native_client__
#include "render/shaders/shader.h"
#include "render/shaders/shaderprogram.h"
@@ -141,4 +141,4 @@ ShaderProgram *ShadersManager::getGles2Program()
false);
}
-#endif
+#endif // USE_OPENGL
diff --git a/src/render/surfacegraphics.cpp b/src/render/surfacegraphics.cpp
index f499e2c14..7c3bfaa57 100644
--- a/src/render/surfacegraphics.cpp
+++ b/src/render/surfacegraphics.cpp
@@ -63,7 +63,8 @@ void SurfaceGraphics::drawImage(const Image *restrict const image,
#ifdef USE_SDL2
SDL_BlitSurface(image->mSDLSurface, &srcRect, mTarget, &dstRect);
-#else
+#else // USE_SDL2
+
if (mBlitMode == BlitMode::BLIT_NORMAL)
{
SDL_BlitSurface(image->mSDLSurface, &srcRect, mTarget, &dstRect);
@@ -73,7 +74,7 @@ void SurfaceGraphics::drawImage(const Image *restrict const image,
SurfaceImageHelper::combineSurface(image->mSDLSurface,
&srcRect, mTarget, &dstRect);
}
-#endif
+#endif // USE_SDL2
}
void SurfaceGraphics::copyImage(const Image *restrict const image,
@@ -97,9 +98,10 @@ void SurfaceGraphics::copyImage(const Image *restrict const image,
#ifdef USE_SDL2
// probably need change some flags
SDL_BlitSurface(image->mSDLSurface, &srcRect, mTarget, &dstRect);
-#else
+#else // USE_SDL2
+
SDL_BlitSurface(image->mSDLSurface, &srcRect, mTarget, &dstRect);
-#endif
+#endif // USE_SDL2
}
void SurfaceGraphics::drawImageCached(const Image *restrict const image,
@@ -123,7 +125,8 @@ void SurfaceGraphics::drawImageCached(const Image *restrict const image,
#ifdef USE_SDL2
SDL_BlitSurface(image->mSDLSurface, &srcRect, mTarget, &dstRect);
-#else
+#else // USE_SDL2
+
if (mBlitMode == BlitMode::BLIT_NORMAL)
{
SDL_BlitSurface(image->mSDLSurface, &srcRect, mTarget, &dstRect);
@@ -133,7 +136,7 @@ void SurfaceGraphics::drawImageCached(const Image *restrict const image,
SurfaceImageHelper::combineSurface(image->mSDLSurface, &srcRect,
mTarget, &dstRect);
}
-#endif
+#endif // USE_SDL2
}
void SurfaceGraphics::completeCache() restrict2
diff --git a/src/render/vertexes/imagecollection.cpp b/src/render/vertexes/imagecollection.cpp
index 47c45b18c..6e8e74877 100644
--- a/src/render/vertexes/imagecollection.cpp
+++ b/src/render/vertexes/imagecollection.cpp
@@ -27,7 +27,7 @@
ImageCollection::ImageCollection() :
#ifdef USE_OPENGL
currentGLImage(0),
-#endif
+#endif // USE_OPENGL
currentImage(nullptr),
currentVert(nullptr),
draws()
@@ -43,7 +43,7 @@ void ImageCollection::clear() restrict2
{
#ifdef USE_OPENGL
currentGLImage = 0;
-#endif
+#endif // USE_OPENGL
currentImage = nullptr;
currentVert = nullptr;
diff --git a/src/render/vertexes/imagecollection.h b/src/render/vertexes/imagecollection.h
index 922fb6bd5..211a2959e 100644
--- a/src/render/vertexes/imagecollection.h
+++ b/src/render/vertexes/imagecollection.h
@@ -40,7 +40,8 @@ class ImageCollection final
#ifdef USE_OPENGL
GLuint currentGLImage;
-#endif
+#endif // USE_OPENGL
+
const Image *restrict currentImage;
ImageVertexes *restrict currentVert;
diff --git a/src/render/vertexes/imagevertexes.cpp b/src/render/vertexes/imagevertexes.cpp
index 675078faf..6a43baa34 100644
--- a/src/render/vertexes/imagevertexes.cpp
+++ b/src/render/vertexes/imagevertexes.cpp
@@ -28,7 +28,7 @@ ImageVertexes::ImageVertexes() :
image(nullptr),
#ifdef USE_OPENGL
ogl(),
-#endif
+#endif // USE_OPENGL
sdl()
{
sdl.reserve(30);
diff --git a/src/render/vertexes/imagevertexes.h b/src/render/vertexes/imagevertexes.h
index 16d50f158..74c1baa30 100644
--- a/src/render/vertexes/imagevertexes.h
+++ b/src/render/vertexes/imagevertexes.h
@@ -47,7 +47,8 @@ class ImageVertexes final
const Image *restrict image;
#ifdef USE_OPENGL
OpenGLGraphicsVertexes ogl;
-#endif
+#endif // USE_OPENGL
+
DoubleRects sdl;
};
diff --git a/src/render/vertexes/openglgraphicsvertexes.cpp b/src/render/vertexes/openglgraphicsvertexes.cpp
index ee442355f..b60efbc4f 100644
--- a/src/render/vertexes/openglgraphicsvertexes.cpp
+++ b/src/render/vertexes/openglgraphicsvertexes.cpp
@@ -222,4 +222,4 @@ GLint *OpenGLGraphicsVertexes::continueIntTexArray() restrict2
}
return mIntTexArray;
}
-#endif
+#endif // USE_OPENGL
diff --git a/src/render/vertexes/openglgraphicsvertexes.h b/src/render/vertexes/openglgraphicsvertexes.h
index 853161b87..ea2ff86d2 100644
--- a/src/render/vertexes/openglgraphicsvertexes.h
+++ b/src/render/vertexes/openglgraphicsvertexes.h
@@ -25,12 +25,12 @@
#ifdef ANDROID
#include <GLES/gl.h>
-#else
+#else // ANDROID
#ifndef USE_SDL2
#define GL_GLEXT_PROTOTYPES 1
-#endif
+#endif // USE_SDL2
#include <SDL_opengl.h>
-#endif
+#endif // ANDROID
#include <vector>