ManaPlus
|
#include <graphicsmanager.h>
Public Member Functions | |
GraphicsManager () | |
~GraphicsManager () | |
void | createRenderers () |
void | initGraphics () |
bool | getAllVideoModes (StringVect &modeList) |
void | detectPixelSize () |
std::string | getDensityString () const |
int | getDensity () const |
TestMain * | startDetection () |
int | detectGraphics () |
bool | supportExtension (const std::string &ext) const |
void | updateTextureCompressionFormat () const |
bool | checkGLVersion (const int major, const int minor) const |
bool | checkGLesVersion (const int major, const int minor) const |
bool | checkSLVersion (const int major, const int minor) const |
bool | checkPlatformVersion (const int major, const int minor) const |
void | initOpenGLFunctions () |
void | updateExtensions () |
void | updatePlanformExtensions () |
void | initOpenGL () |
void | updateLimits () |
int | getMaxVertices () const |
bool | getUseAtlases () const |
void | logVersion () const |
void | setGLVersion () |
void | detectVideoSettings () |
void | createTextureSampler () |
bool | isUseTextureSampler () const |
void | updateDebugLog () const |
std::string | getGLVersion () const |
Static Public Member Functions | |
static void | deleteRenderers () |
static void | setVideoMode () |
static SDL_Surface * | createWindow (const int w, const int h, const int bpp, const int flags) |
static void | updateTextureFormat () |
static void | createFBO (const int width, const int height, FBOInfo *const fbo) |
static void | deleteFBO (FBOInfo *const fbo) |
static std::string | getGLString (const int num) |
static void | logString (const char *const format, const int num) |
static GLenum | getLastError () |
static std::string | errorToString (const GLenum error) |
static void | logError () |
static GLenum | getLastErrorCached () |
static void | resetCachedError () |
Private Attributes | |
std::set< std::string > | mExtensions |
std::set< std::string > | mPlatformExtensions |
std::string | mGlVersionString |
std::string | mGlVendor |
std::string | mGlRenderer |
std::string | mGlShaderVersionString |
int | mMinor |
int | mMajor |
int | mSLMinor |
int | mSLMajor |
int | mPlatformMinor |
int | mPlatformMajor |
int | mMaxVertices |
int | mMaxFboSize |
uint32_t | mMaxWidth |
uint32_t | mMaxHeight |
uint32_t | mWidthMM |
uint32_t | mHeightMM |
int32_t | mDensity |
bool | mUseTextureSampler |
GLuint | mTextureSampler |
int | mSupportDebug |
bool | mSupportModernOpengl |
bool | mGles |
bool | mUseAtlases |
Static Private Attributes | |
static GLenum | mLastError |
Definition at line 72 of file graphicsmanager.h.
GraphicsManager::GraphicsManager | ( | ) |
Definition at line 137 of file graphicsmanager.cpp.
GraphicsManager::~GraphicsManager | ( | ) |
bool GraphicsManager::checkGLesVersion | ( | const int | major, |
const int | minor | ||
) | const |
Definition at line 930 of file graphicsmanager.cpp.
References mGles, mMajor, and mMinor.
Referenced by initGraphics(), and updateTextureCompressionFormat().
bool GraphicsManager::checkGLVersion | ( | const int | major, |
const int | minor | ||
) | const |
Definition at line 920 of file graphicsmanager.cpp.
References mMajor, and mMinor.
Referenced by detectGraphics(), initGraphics(), initOpenGLFunctions(), updateExtensions(), and updateTextureCompressionFormat().
bool GraphicsManager::checkPlatformVersion | ( | const int | major, |
const int | minor | ||
) | const |
Definition at line 935 of file graphicsmanager.cpp.
References mPlatformMajor, and mPlatformMinor.
Referenced by updatePlanformExtensions().
bool GraphicsManager::checkSLVersion | ( | const int | major, |
const int | minor | ||
) | const |
|
static |
Definition at line 942 of file graphicsmanager.cpp.
References GL_COLOR_ATTACHMENT0, GL_DEPTH_ATTACHMENT, GL_FRAMEBUFFER, GL_RENDERBUFFER, and OpenGLImageHelper::mTextureType.
Referenced by MobileOpenGLScreenshotHelper::prepare(), and OpenGLScreenshotHelper::prepare().
void GraphicsManager::createRenderers | ( | ) |
Definition at line 340 of file graphicsmanager.cpp.
References CAST_S32, config, Configuration::getBoolValue(), Configuration::getIntValue(), imageHelper, intToRenderType(), mainGraphics, mUseAtlases, mUseTextureSampler, Options::noOpenGL, Settings::options, RENDER_GLES2_OPENGL, RENDER_GLES2_OPENGL_INIT, RENDER_GLES_OPENGL, RENDER_GLES_OPENGL_INIT, RENDER_LAST, RENDER_MODERN_OPENGL, RENDER_MODERN_OPENGL_INIT, RENDER_NORMAL_OPENGL, RENDER_NORMAL_OPENGL_INIT, RENDER_NULL, RENDER_SAFE_OPENGL, RENDER_SAFE_OPENGL_INIT, RENDER_SDL2_DEFAULT, RENDER_SDL2_DEFAULT_INIT, RENDER_SOFTWARE, RENDER_SOFTWARE_INIT, Options::renderer, screenshortHelper, ImageHelper::setOpenGlMode(), settings, surfaceImageHelper, and SurfaceImageHelper.
Referenced by initGraphics().
void GraphicsManager::createTextureSampler | ( | ) |
Definition at line 1445 of file graphicsmanager.cpp.
References errorToString(), getLastError(), OpenGLImageHelper::initTextureSampler(), Logger::log(), Logger::log1(), logger, mTextureSampler, mUseTextureSampler, OpenGLImageHelper::setUseTextureSampler(), and SafeOpenGLImageHelper::setUseTextureSampler().
Referenced by initOpenGL().
|
static |
Definition at line 640 of file graphicsmanager.cpp.
Referenced by detectGraphics(), main(), and Graphics::setOpenGLMode().
|
static |
Definition at line 986 of file graphicsmanager.cpp.
References GL_FRAMEBUFFER, and GL_RENDERBUFFER.
Referenced by MobileOpenGLScreenshotHelper::getScreenshot(), and OpenGLScreenshotHelper::getScreenshot().
|
static |
Definition at line 448 of file graphicsmanager.cpp.
References delete2, imageHelper, mainGraphics, and surfaceImageHelper.
Referenced by Client::gameClear(), and initGraphics().
int GraphicsManager::detectGraphics | ( | ) |
< Allow any video depth/pixel-format
< Create an OpenGL rendering context
Definition at line 184 of file graphicsmanager.cpp.
References CAST_S32, CAST_U32, checkGLVersion(), config, Graphics::createGLContext(), createWindow(), findI(), initOpenGL(), Logger::log(), Logger::log1(), logger, logVersion(), mainGraphics, mGlRenderer, mGlVendor, mGlVersionString, RENDER_NORMAL_OPENGL, RENDER_SOFTWARE, SDL_Window, Configuration::setValue(), Graphics::setWindow(), and Configuration::write().
Referenced by TestLauncher::testVideoDetection().
void GraphicsManager::detectPixelSize | ( | ) |
Definition at line 1663 of file graphicsmanager.cpp.
References config, densitySize, getDensityString(), Configuration::getIntValue(), Graphics::getWindow(), SDL::getWindowWMInfo(), Actions::info(), Logger::log(), logger, mainGraphics, mDensity, mHeightMM, mMaxHeight, mMaxWidth, and mWidthMM.
Referenced by initGraphics().
void GraphicsManager::detectVideoSettings | ( | ) |
Definition at line 1528 of file graphicsmanager.cpp.
References CAST_S32, config, TestMain::getConfig(), ConfigurationObject::getValue(), ConfigurationObject::getValueInt(), RENDER_LAST, Configuration::setValue(), and startDetection().
Referenced by Client::gameInit().
|
static |
Definition at line 1488 of file graphicsmanager.cpp.
References Actions::error().
Referenced by createTextureSampler(), OpenGLImageHelper::glLoad(), SafeOpenGLImageHelper::glLoad(), and logError().
bool GraphicsManager::getAllVideoModes | ( | StringVect & | modeList | ) |
|
inline |
Definition at line 103 of file graphicsmanager.h.
References mDensity.
Referenced by setConfigDefaults2().
std::string GraphicsManager::getDensityString | ( | ) | const |
Definition at line 1733 of file graphicsmanager.cpp.
References densityNames, densitySize, and mDensity.
Referenced by detectPixelSize(), and Theme::selectSkin().
|
static |
Definition at line 878 of file graphicsmanager.cpp.
References mglGetString.
Referenced by setGLVersion().
|
inline |
|
static |
Definition at line 1475 of file graphicsmanager.cpp.
References Actions::error(), and mLastError.
Referenced by createTextureSampler(), OpenGLImageHelper::glLoad(), SafeOpenGLImageHelper::glLoad(), logError(), and TestLauncher::testTextures().
|
inlinestatic |
Definition at line 177 of file graphicsmanager.h.
References mLastError.
Referenced by TestLauncher::testTextures().
|
inline |
Definition at line 144 of file graphicsmanager.h.
References mMaxVertices.
Referenced by Graphics::setOpenGLMode().
|
inline |
Definition at line 147 of file graphicsmanager.h.
References mUseAtlases.
Referenced by MapReader::loadEmptyAtlas(), and MapReader::readTileset().
void GraphicsManager::initGraphics | ( | ) |
Definition at line 536 of file graphicsmanager.cpp.
References CAST_S32, CAST_SIZE, checkGLesVersion(), checkGLVersion(), config, createRenderers(), deleteRenderers(), detectPixelSize(), Configuration::getBoolValue(), Configuration::getFloatValue(), Configuration::getIntValue(), Configuration::getStringValue(), intToRenderType(), Logger::log(), logger, mSupportModernOpengl, openGLMode, Settings::options, RENDER_GLES2_OPENGL, RENDER_GLES_OPENGL, RENDER_MODERN_OPENGL, RENDER_NORMAL_OPENGL, RENDER_SAFE_OPENGL, RENDER_SOFTWARE, Options::renderer, OpenGLImageHelper::setBlur(), SafeOpenGLImageHelper::setBlur(), ImageHelper::setEnableAlpha(), settings, Configuration::setValue(), setVideoMode(), splitToIntVector(), and Settings::textureSize.
Referenced by Client::initGraphics().
void GraphicsManager::initOpenGL | ( | ) |
Definition at line 1434 of file graphicsmanager.cpp.
References createTextureSampler(), initOpenGLFunctions(), setGLVersion(), updateDebugLog(), updateExtensions(), updateLimits(), and updatePlanformExtensions().
Referenced by detectGraphics(), and Graphics::setOpenGLMode().
void GraphicsManager::initOpenGLFunctions | ( | ) |
Definition at line 1010 of file graphicsmanager.cpp.
References assignFunction, assignFunction2, assignFunctionARB, assignFunctionEmu2, assignFunctionEXT, checkGLVersion(), config, emulateFunction, Configuration::getBoolValue(), isGLNotNull, isGLNull, Logger::log1(), logger, mSupportDebug, mSupportModernOpengl, mUseTextureSampler, Configuration::setValue(), and supportExtension().
Referenced by initOpenGL().
|
inline |
Definition at line 163 of file graphicsmanager.h.
References mUseTextureSampler.
Referenced by Graphics::setOpenGLMode().
|
static |
Definition at line 1521 of file graphicsmanager.cpp.
References Actions::error(), errorToString(), getLastError(), Logger::log(), and logger.
Referenced by OpenGLImageHelper::copySurfaceToImage(), NormalOpenGLGraphics::drawLineArrayf(), NormalOpenGLGraphics::drawLineArrayi(), MobileOpenGL2Graphics::drawLineArrays(), MobileOpenGLGraphics::drawLineArrays(), ModernOpenGLGraphics::drawLineArrays(), drawQuad(), MobileOpenGL2Graphics::drawQuad(), ModernOpenGLGraphics::drawQuad(), NormalOpenGLGraphics::drawQuadArrayfi(), NormalOpenGLGraphics::drawQuadArrayfiCached(), NormalOpenGLGraphics::drawQuadArrayii(), NormalOpenGLGraphics::drawQuadArrayiiCached(), drawRescaledQuad(), MobileOpenGL2Graphics::drawRescaledQuad(), ModernOpenGLGraphics::drawRescaledQuad(), MobileOpenGL2Graphics::drawTriangleArray(), ModernOpenGLGraphics::drawTriangleArray(), MobileOpenGLGraphics::drawTriangleArrayfs(), MobileOpenGLGraphics::drawTriangleArrayfsCached(), emuglTextureSubImage2DEXT(), OpenGLImageHelper::glLoad(), MobileOpenGL2Graphics::postInit(), ModernOpenGLGraphics::postInit(), MobileOpenGL2Graphics::testDraw(), ModernOpenGLGraphics::testDraw(), and NormalOpenGLGraphics::testDraw().
|
static |
Definition at line 869 of file graphicsmanager.cpp.
References Logger::log(), logger, and mglGetString.
void GraphicsManager::logVersion | ( | ) | const |
Definition at line 912 of file graphicsmanager.cpp.
References Logger::log(), logger, mGlRenderer, mGlShaderVersionString, mGlVendor, and mGlVersionString.
Referenced by detectGraphics(), and Graphics::setOpenGLMode().
|
inlinestatic |
Definition at line 180 of file graphicsmanager.h.
References mLastError.
Referenced by TestLauncher::testTextures().
void GraphicsManager::setGLVersion | ( | ) |
Definition at line 884 of file graphicsmanager.cpp.
References cutFirst(), findCutFirst(), getGLString(), Logger::log(), logger, mGles, mGlRenderer, mGlShaderVersionString, mGlVendor, mGlVersionString, mMajor, mMinor, mSLMajor, and mSLMinor.
Referenced by initOpenGL(), and Graphics::setOpenGLMode().
|
static |
Definition at line 457 of file graphicsmanager.cpp.
References config, ConfigurationObject::deleteKey(), Logger::error(), SDL::getAllVideoModes(), Configuration::getBoolValue(), Configuration::getIntValue(), ConfigurationObject::getValueInt(), Actions::info(), Logger::log(), logger, mainGraphics, Logger::safeError(), Configuration::setValue(), Configuration::setValueInt(), Graphics::setVideoMode(), splitToIntVector(), and strprintf().
Referenced by initGraphics().
TestMain * GraphicsManager::startDetection | ( | ) |
Definition at line 177 of file graphicsmanager.cpp.
References TestMain::exec().
Referenced by Setup_Video::action(), and detectVideoSettings().
bool GraphicsManager::supportExtension | ( | const std::string & | ext | ) | const |
Definition at line 758 of file graphicsmanager.cpp.
References mExtensions.
Referenced by Graphics::getMemoryUsage(), initOpenGLFunctions(), Graphics::setOpenGLMode(), Graphics::updateMemoryInfo(), and updateTextureCompressionFormat().
void GraphicsManager::updateDebugLog | ( | ) | const |
Definition at line 1648 of file graphicsmanager.cpp.
References config, debugCallback(), Configuration::getIntValue(), GL_DEBUG_OUTPUT, GL_DEBUG_OUTPUT_SYNCHRONOUS, Logger::log1(), logger, and mSupportDebug.
Referenced by initOpenGL().
void GraphicsManager::updateExtensions | ( | ) |
Definition at line 648 of file graphicsmanager.cpp.
References assignFunction2, checkGLVersion(), GL_NUM_EXTENSIONS, Logger::log1(), logger, mExtensions, mglGetString, and splitToStringSet().
Referenced by initOpenGL().
void GraphicsManager::updateLimits | ( | ) |
Definition at line 1403 of file graphicsmanager.cpp.
References GL_MAX_ELEMENTS_INDICES, GL_MAX_ELEMENTS_VERTICES, Logger::log(), logger, mMaxFboSize, and mMaxVertices.
Referenced by initOpenGL().
void GraphicsManager::updatePlanformExtensions | ( | ) |
Definition at line 679 of file graphicsmanager.cpp.
References checkPlatformVersion(), Graphics::getWindow(), SDL::getWindowWMInfo(), Actions::info(), Logger::log(), Logger::log1(), logger, mainGraphics, mPlatformExtensions, mPlatformMajor, mPlatformMinor, and splitToStringSet().
Referenced by initOpenGL().
void GraphicsManager::updateTextureCompressionFormat | ( | ) | const |
Definition at line 763 of file graphicsmanager.cpp.
References CAST_SIZE, CAST_U32, checkGLesVersion(), checkGLVersion(), config, Configuration::getIntValue(), GL_COMPRESSED_RGBA_ARB, GL_COMPRESSED_RGBA_BPTC_UNORM_ARB, GL_COMPRESSED_RGBA_FXT1_3DFX, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, Logger::log(), Logger::log1(), logger, mglGetIntegerv, supportExtension(), and useCompression.
Referenced by Graphics::setOpenGLMode().
|
static |
Definition at line 841 of file graphicsmanager.cpp.
References config, Configuration::getBoolValue(), Logger::log1(), logger, Settings::options, RENDER_GLES2_OPENGL, RENDER_GLES_OPENGL, RENDER_MODERN_OPENGL, Options::renderer, OpenGLImageHelper::setInternalTextureType(), SafeOpenGLImageHelper::setInternalTextureType(), and settings.
Referenced by Graphics::setOpenGLMode().
|
private |
Definition at line 224 of file graphicsmanager.h.
Referenced by detectPixelSize(), getDensity(), and getDensityString().
|
private |
Definition at line 185 of file graphicsmanager.h.
Referenced by supportExtension(), and updateExtensions().
|
private |
Definition at line 235 of file graphicsmanager.h.
Referenced by checkGLesVersion(), and setGLVersion().
|
private |
Definition at line 193 of file graphicsmanager.h.
Referenced by detectGraphics(), logVersion(), and setGLVersion().
|
private |
Definition at line 195 of file graphicsmanager.h.
Referenced by logVersion(), and setGLVersion().
|
private |
Definition at line 191 of file graphicsmanager.h.
Referenced by detectGraphics(), logVersion(), and setGLVersion().
|
private |
Definition at line 189 of file graphicsmanager.h.
Referenced by detectGraphics(), getGLVersion(), logVersion(), and setGLVersion().
|
private |
Definition at line 222 of file graphicsmanager.h.
Referenced by detectPixelSize().
|
staticprivate |
Definition at line 197 of file graphicsmanager.h.
Referenced by getLastError(), getLastErrorCached(), and resetCachedError().
|
private |
Definition at line 202 of file graphicsmanager.h.
Referenced by checkGLesVersion(), checkGLVersion(), and setGLVersion().
|
private |
Definition at line 214 of file graphicsmanager.h.
Referenced by updateLimits().
|
private |
Definition at line 218 of file graphicsmanager.h.
Referenced by detectPixelSize().
|
private |
Definition at line 212 of file graphicsmanager.h.
Referenced by getMaxVertices(), and updateLimits().
|
private |
Definition at line 216 of file graphicsmanager.h.
Referenced by detectPixelSize().
|
private |
Definition at line 200 of file graphicsmanager.h.
Referenced by checkGLesVersion(), checkGLVersion(), and setGLVersion().
|
private |
Definition at line 187 of file graphicsmanager.h.
Referenced by updatePlanformExtensions().
|
private |
Definition at line 210 of file graphicsmanager.h.
Referenced by checkPlatformVersion(), and updatePlanformExtensions().
|
private |
Definition at line 208 of file graphicsmanager.h.
Referenced by checkPlatformVersion(), and updatePlanformExtensions().
|
private |
Definition at line 206 of file graphicsmanager.h.
Referenced by checkSLVersion(), and setGLVersion().
|
private |
Definition at line 204 of file graphicsmanager.h.
Referenced by checkSLVersion(), and setGLVersion().
|
private |
Definition at line 231 of file graphicsmanager.h.
Referenced by initOpenGLFunctions(), and updateDebugLog().
|
private |
Definition at line 233 of file graphicsmanager.h.
Referenced by initGraphics(), and initOpenGLFunctions().
|
private |
Definition at line 229 of file graphicsmanager.h.
Referenced by createTextureSampler(), and ~GraphicsManager().
|
private |
Definition at line 238 of file graphicsmanager.h.
Referenced by createRenderers(), and getUseAtlases().
|
private |
Definition at line 227 of file graphicsmanager.h.
Referenced by createRenderers(), createTextureSampler(), initOpenGLFunctions(), and isUseTextureSampler().
|
private |
Definition at line 220 of file graphicsmanager.h.
Referenced by detectPixelSize().