From 4821f538a888370eb80ec28f9bab269a4427a63c Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 25 Apr 2017 16:55:35 +0300 Subject: Report into log OpenGL errors if enabled configure option --enable-openglerrors. --- src/resources/openglimagehelper.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/resources') diff --git a/src/resources/openglimagehelper.cpp b/src/resources/openglimagehelper.cpp index 9af9c6643..391c3b9b5 100644 --- a/src/resources/openglimagehelper.cpp +++ b/src/resources/openglimagehelper.cpp @@ -339,6 +339,9 @@ Image *OpenGLImageHelper::glLoad(SDL_Surface *tmpImage, mUseOpenGL != RENDER_GLES2_OPENGL) { glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); +#ifdef OPENGLERRORS + graphicsManager.logError(); +#endif // OPENGLERRORS } if (!mUseTextureSampler) @@ -346,12 +349,26 @@ Image *OpenGLImageHelper::glLoad(SDL_Surface *tmpImage, if (mBlur) { mglTexParameteri(mTextureType, GL_TEXTURE_MIN_FILTER, GL_LINEAR); +#ifdef OPENGLERRORS + graphicsManager.logError(); +#endif // OPENGLERRORS + mglTexParameteri(mTextureType, GL_TEXTURE_MAG_FILTER, GL_LINEAR); +#ifdef OPENGLERRORS + graphicsManager.logError(); +#endif // OPENGLERRORS } else { mglTexParameteri(mTextureType, GL_TEXTURE_MIN_FILTER, GL_NEAREST); +#ifdef OPENGLERRORS + graphicsManager.logError(); +#endif // OPENGLERRORS + mglTexParameteri(mTextureType, GL_TEXTURE_MAG_FILTER, GL_NEAREST); +#ifdef OPENGLERRORS + graphicsManager.logError(); +#endif // OPENGLERRORS } } #if !defined(ANDROID) && !defined(__native_client__) @@ -361,6 +378,9 @@ Image *OpenGLImageHelper::glLoad(SDL_Surface *tmpImage, mglTexImage2D(mTextureType, 0, mInternalTextureType, tmpImage->w, tmpImage->h, 0, GL_RGBA, GL_UNSIGNED_BYTE, tmpImage->pixels); +#ifdef OPENGLERRORS + graphicsManager.logError(); +#endif // OPENGLERRORS #ifdef DEBUG_OPENGL /* @@ -499,6 +519,9 @@ void OpenGLImageHelper::copySurfaceToImage(const Image *const image, surface->w, surface->h, GL_RGBA, GL_UNSIGNED_BYTE, surface->pixels); } +#ifdef OPENGLERRORS + graphicsManager.logError(); +#endif // OPENGLERRORS if (surface != oldSurface) MSDL_FreeSurface(surface); -- cgit v1.2.3-70-g09d2