From e11f4df1118eb0858f4d3bfda697e63174d5e2d1 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 12 Dec 2015 03:22:51 +0100 Subject: OPENGL: Rename GLCALL to GL_CALL. --- backends/graphics/opengl/opengl-graphics.cpp | 68 ++++++++++++++-------------- backends/graphics/opengl/opengl-sys.h | 2 +- backends/graphics/opengl/texture.cpp | 42 ++++++++--------- 3 files changed, 56 insertions(+), 56 deletions(-) (limited to 'backends/graphics') diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp index 2af7da5f1f..34d4ca888c 100644 --- a/backends/graphics/opengl/opengl-graphics.cpp +++ b/backends/graphics/opengl/opengl-graphics.cpp @@ -370,13 +370,13 @@ void OpenGLGraphicsManager::updateScreen() { // cleared. For example, when switching from overlay visible to // invisible, we need to assure that all contents are cleared to // properly remove all overlay contents. - GLCALL(glDisable(GL_SCISSOR_TEST)); - GLCALL(glClear(GL_COLOR_BUFFER_BIT)); - GLCALL(glEnable(GL_SCISSOR_TEST)); + GL_CALL(glDisable(GL_SCISSOR_TEST)); + GL_CALL(glClear(GL_COLOR_BUFFER_BIT)); + GL_CALL(glEnable(GL_SCISSOR_TEST)); --_scissorOverride; } else { - GLCALL(glClear(GL_COLOR_BUFFER_BIT)); + GL_CALL(glClear(GL_COLOR_BUFFER_BIT)); } const GLfloat shakeOffset = _gameScreenShakeOffset * (GLfloat)_displayHeight / _gameScreen->getHeight(); @@ -418,13 +418,13 @@ void OpenGLGraphicsManager::updateScreen() { } // Set the OSD transparency. - GLCALL(glColor4f(1.0f, 1.0f, 1.0f, _osdAlpha / 100.0f)); + GL_CALL(glColor4f(1.0f, 1.0f, 1.0f, _osdAlpha / 100.0f)); // Draw the OSD texture. _osd->draw(0, 0, _outputScreenWidth, _outputScreenHeight); // Reset color. - GLCALL(glColor4f(1.0f, 1.0f, 1.0f, 1.0f)); + GL_CALL(glColor4f(1.0f, 1.0f, 1.0f, 1.0f)); } #endif @@ -466,7 +466,7 @@ void OpenGLGraphicsManager::showOverlay() { _forceRedraw = true; // Allow drawing inside full screen area. - GLCALL(glDisable(GL_SCISSOR_TEST)); + GL_CALL(glDisable(GL_SCISSOR_TEST)); // Update cursor position. setMousePosition(_cursorX, _cursorY); @@ -477,7 +477,7 @@ void OpenGLGraphicsManager::hideOverlay() { _forceRedraw = true; // Limit drawing to screen area. - GLCALL(glEnable(GL_SCISSOR_TEST)); + GL_CALL(glEnable(GL_SCISSOR_TEST)); _scissorOverride = 3; // Update cursor position. @@ -755,17 +755,17 @@ void OpenGLGraphicsManager::setActualScreenSize(uint width, uint height) { _outputScreenHeight = height; // Setup coordinates system. - GLCALL(glViewport(0, 0, _outputScreenWidth, _outputScreenHeight)); + GL_CALL(glViewport(0, 0, _outputScreenWidth, _outputScreenHeight)); - GLCALL(glMatrixMode(GL_PROJECTION)); - GLCALL(glLoadIdentity()); + GL_CALL(glMatrixMode(GL_PROJECTION)); + GL_CALL(glLoadIdentity()); #ifdef USE_GLES - GLCALL(glOrthof(0, _outputScreenWidth, _outputScreenHeight, 0, -1, 1)); + GL_CALL(glOrthof(0, _outputScreenWidth, _outputScreenHeight, 0, -1, 1)); #else - GLCALL(glOrtho(0, _outputScreenWidth, _outputScreenHeight, 0, -1, 1)); + GL_CALL(glOrtho(0, _outputScreenWidth, _outputScreenHeight, 0, -1, 1)); #endif - GLCALL(glMatrixMode(GL_MODELVIEW)); - GLCALL(glLoadIdentity()); + GL_CALL(glMatrixMode(GL_MODELVIEW)); + GL_CALL(glLoadIdentity()); uint overlayWidth = width; uint overlayHeight = height; @@ -839,33 +839,33 @@ void OpenGLGraphicsManager::notifyContextCreate(const Graphics::PixelFormat &def initializeGLContext(); // Disable 3D properties. - GLCALL(glDisable(GL_CULL_FACE)); - GLCALL(glDisable(GL_DEPTH_TEST)); - GLCALL(glDisable(GL_LIGHTING)); - GLCALL(glDisable(GL_FOG)); - GLCALL(glDisable(GL_DITHER)); - GLCALL(glShadeModel(GL_FLAT)); - GLCALL(glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST)); + GL_CALL(glDisable(GL_CULL_FACE)); + GL_CALL(glDisable(GL_DEPTH_TEST)); + GL_CALL(glDisable(GL_LIGHTING)); + GL_CALL(glDisable(GL_FOG)); + GL_CALL(glDisable(GL_DITHER)); + GL_CALL(glShadeModel(GL_FLAT)); + GL_CALL(glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST)); // Default to black as clear color. - GLCALL(glClearColor(0.0f, 0.0f, 0.0f, 0.0f)); - GLCALL(glColor4f(1.0f, 1.0f, 1.0f, 1.0f)); + GL_CALL(glClearColor(0.0f, 0.0f, 0.0f, 0.0f)); + GL_CALL(glColor4f(1.0f, 1.0f, 1.0f, 1.0f)); // Setup alpha blend (for overlay and cursor). - GLCALL(glEnable(GL_BLEND)); - GLCALL(glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)); + GL_CALL(glEnable(GL_BLEND)); + GL_CALL(glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)); // Enable rendering with vertex and coord arrays. - GLCALL(glEnableClientState(GL_VERTEX_ARRAY)); - GLCALL(glEnableClientState(GL_TEXTURE_COORD_ARRAY)); + GL_CALL(glEnableClientState(GL_VERTEX_ARRAY)); + GL_CALL(glEnableClientState(GL_TEXTURE_COORD_ARRAY)); - GLCALL(glEnable(GL_TEXTURE_2D)); + GL_CALL(glEnable(GL_TEXTURE_2D)); // Setup scissor state accordingly. if (_overlayVisible) { - GLCALL(glDisable(GL_SCISSOR_TEST)); + GL_CALL(glDisable(GL_SCISSOR_TEST)); } else { - GLCALL(glEnable(GL_SCISSOR_TEST)); + GL_CALL(glEnable(GL_SCISSOR_TEST)); } // Clear the whole screen for the first three frames to assure any // leftovers are cleared. @@ -874,7 +874,7 @@ void OpenGLGraphicsManager::notifyContextCreate(const Graphics::PixelFormat &def // We use a "pack" alignment (when reading from textures) to 4 here, // since the only place where we really use it is the BMP screenshot // code and that requires the same alignment too. - GLCALL(glPixelStorei(GL_PACK_ALIGNMENT, 4)); + GL_CALL(glPixelStorei(GL_PACK_ALIGNMENT, 4)); // Query information needed by textures. Texture::queryTextureInformation(); @@ -1118,7 +1118,7 @@ void OpenGLGraphicsManager::recalculateDisplayArea() { // Setup drawing limitation for game graphics. // This invovles some trickery because OpenGL's viewport coordinate system // is upside down compared to ours. - GLCALL(glScissor(_displayX, + GL_CALL(glScissor(_displayX, _outputScreenHeight - _displayHeight - _displayY, _displayWidth, _displayHeight)); @@ -1206,7 +1206,7 @@ void OpenGLGraphicsManager::saveScreenshot(const Common::String &filename) const uint8 *pixels = new uint8[lineSize * height]; // Get pixel data from OpenGL buffer - GLCALL(glReadPixels(0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE, pixels)); + GL_CALL(glReadPixels(0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE, pixels)); // BMP stores as BGR. Since we can't assume that GL_BGR is supported we // will swap the components from the RGB we read to BGR on our own. diff --git a/backends/graphics/opengl/opengl-sys.h b/backends/graphics/opengl/opengl-sys.h index 08b3b4581c..f78b3377b3 100644 --- a/backends/graphics/opengl/opengl-sys.h +++ b/backends/graphics/opengl/opengl-sys.h @@ -87,6 +87,6 @@ extern Context g_context; } // End of namespace OpenGL -#define GLCALL(x) GL_WRAP_DEBUG(g_context.x, x) +#define GL_CALL(x) GL_WRAP_DEBUG(g_context.x, x) #endif diff --git a/backends/graphics/opengl/texture.cpp b/backends/graphics/opengl/texture.cpp index bc255004e7..b866b15bfd 100644 --- a/backends/graphics/opengl/texture.cpp +++ b/backends/graphics/opengl/texture.cpp @@ -42,7 +42,7 @@ static GLuint nextHigher2(GLuint v) { GLint Texture::_maxTextureSize = 0; void Texture::queryTextureInformation() { - GLCALL(glGetIntegerv(GL_MAX_TEXTURE_SIZE, &_maxTextureSize)); + GL_CALL(glGetIntegerv(GL_MAX_TEXTURE_SIZE, &_maxTextureSize)); debug(5, "OpenGL maximum texture size: %d", _maxTextureSize); } @@ -58,7 +58,7 @@ Texture::~Texture() { } void Texture::releaseInternalTexture() { - GLCALL(glDeleteTextures(1, &_glTexture)); + GL_CALL(glDeleteTextures(1, &_glTexture)); _glTexture = 0; } @@ -67,20 +67,20 @@ void Texture::recreateInternalTexture() { releaseInternalTexture(); // Get a new texture name. - GLCALL(glGenTextures(1, &_glTexture)); + GL_CALL(glGenTextures(1, &_glTexture)); // Set up all texture parameters. - GLCALL(glBindTexture(GL_TEXTURE_2D, _glTexture)); - GLCALL(glPixelStorei(GL_UNPACK_ALIGNMENT, 1)); - GLCALL(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, _glFilter)); - GLCALL(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, _glFilter)); - GLCALL(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE)); - GLCALL(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE)); + GL_CALL(glBindTexture(GL_TEXTURE_2D, _glTexture)); + GL_CALL(glPixelStorei(GL_UNPACK_ALIGNMENT, 1)); + GL_CALL(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, _glFilter)); + GL_CALL(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, _glFilter)); + GL_CALL(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE)); + GL_CALL(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE)); // In case there is an actual texture setup we reinitialize it. if (_textureData.getPixels()) { // Allocate storage for OpenGL texture. - GLCALL(glTexImage2D(GL_TEXTURE_2D, 0, _glIntFormat, _textureData.w, + GL_CALL(glTexImage2D(GL_TEXTURE_2D, 0, _glIntFormat, _textureData.w, _textureData.h, 0, _glFormat, _glType, NULL)); // Mark dirts such that it will be completely refreshed the next time. @@ -95,10 +95,10 @@ void Texture::enableLinearFiltering(bool enable) { _glFilter = GL_NEAREST; } - GLCALL(glBindTexture(GL_TEXTURE_2D, _glTexture)); + GL_CALL(glBindTexture(GL_TEXTURE_2D, _glTexture)); - GLCALL(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, _glFilter)); - GLCALL(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, _glFilter)); + GL_CALL(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, _glFilter)); + GL_CALL(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, _glFilter)); } void Texture::allocate(uint width, uint height) { @@ -115,10 +115,10 @@ void Texture::allocate(uint width, uint height) { _textureData.create(texWidth, texHeight, _format); // Set the texture. - GLCALL(glBindTexture(GL_TEXTURE_2D, _glTexture)); + GL_CALL(glBindTexture(GL_TEXTURE_2D, _glTexture)); // Allocate storage for OpenGL texture. - GLCALL(glTexImage2D(GL_TEXTURE_2D, 0, _glIntFormat, _textureData.w, + GL_CALL(glTexImage2D(GL_TEXTURE_2D, 0, _glIntFormat, _textureData.w, _textureData.h, 0, _glFormat, _glType, NULL)); } @@ -174,7 +174,7 @@ void Texture::draw(GLfloat x, GLfloat y, GLfloat w, GLfloat h) { updateTexture(); // Set the texture. - GLCALL(glBindTexture(GL_TEXTURE_2D, _glTexture)); + GL_CALL(glBindTexture(GL_TEXTURE_2D, _glTexture)); // Calculate the texture rect that will be drawn. const GLfloat texWidth = (GLfloat)_userPixelData.w / _textureData.w; @@ -185,7 +185,7 @@ void Texture::draw(GLfloat x, GLfloat y, GLfloat w, GLfloat h) { 0, texHeight, texWidth, texHeight }; - GLCALL(glTexCoordPointer(2, GL_FLOAT, 0, texcoords)); + GL_CALL(glTexCoordPointer(2, GL_FLOAT, 0, texcoords)); // Calculate the screen rect where the texture will be drawn. const GLfloat vertices[4*2] = { @@ -194,10 +194,10 @@ void Texture::draw(GLfloat x, GLfloat y, GLfloat w, GLfloat h) { x, y + h, x + w, y + h }; - GLCALL(glVertexPointer(2, GL_FLOAT, 0, vertices)); + GL_CALL(glVertexPointer(2, GL_FLOAT, 0, vertices)); // Draw the texture to the screen buffer. - GLCALL(glDrawArrays(GL_TRIANGLE_STRIP, 0, 4)); + GL_CALL(glDrawArrays(GL_TRIANGLE_STRIP, 0, 4)); } void Texture::updateTexture() { @@ -237,7 +237,7 @@ void Texture::updateTexture() { } // Set the texture. - GLCALL(glBindTexture(GL_TEXTURE_2D, _glTexture)); + GL_CALL(glBindTexture(GL_TEXTURE_2D, _glTexture)); // Update the actual texture. // Although we keep track of the dirty part of the texture buffer we @@ -257,7 +257,7 @@ void Texture::updateTexture() { // // 3) Use glTexSubImage2D per line changed. This is what the old OpenGL // graphics manager did but it is much slower! Thus, we do not use it. - GLCALL(glTexSubImage2D(GL_TEXTURE_2D, 0, 0, dirtyArea.top, _textureData.w, dirtyArea.height(), + GL_CALL(glTexSubImage2D(GL_TEXTURE_2D, 0, 0, dirtyArea.top, _textureData.w, dirtyArea.height(), _glFormat, _glType, _textureData.getBasePtr(0, dirtyArea.top))); // We should have handled everything, thus not dirty anymore. -- cgit v1.2.3