From 13d827728ad47f6362258175ac1706ceb6bb8b8d Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 2 Mar 2012 01:45:23 +0300 Subject: Add opengl settings dump command. Chat command: /dumpogl --- src/commandhandler.cpp | 14 ++++++++++++++ src/commandhandler.h | 2 ++ src/gui/chatwindow.cpp | 1 + src/openglgraphics.cpp | 20 ++++++++++++++++++++ src/openglgraphics.h | 2 ++ 5 files changed, 39 insertions(+) diff --git a/src/commandhandler.cpp b/src/commandhandler.cpp index 9f832c021..67b03e78c 100644 --- a/src/commandhandler.cpp +++ b/src/commandhandler.cpp @@ -57,6 +57,10 @@ #include "net/playerhandler.h" #include "net/tradehandler.h" +#if defined USE_OPENGL +#include "openglgraphics.h" +#endif + #ifdef DEBUG_DUMP_LEAKS #include "resources/image.h" #include "resources/resource.h" @@ -207,6 +211,8 @@ void CommandHandler::handleCommand(const std::string &command, ChatTab *tab) handleDumpGraphics(args, tab); else if (type == "dumpt") handleDumpTests(args, tab); + else if (type == "dumpogl") + handleDumpOGL(args, tab); else if (tab->handleCommand(type, args)) ; else if (type == "hack") @@ -1347,3 +1353,11 @@ void CommandHandler::replaceVars(std::string &str) } } } + +void CommandHandler::handleDumpOGL(const std::string &args A_UNUSED, + ChatTab *tab A_UNUSED) +{ +#if defined USE_OPENGL + OpenGLGraphics::dumpSettings(); +#endif +} diff --git a/src/commandhandler.h b/src/commandhandler.h index d399accf7..a8f21ac7a 100644 --- a/src/commandhandler.h +++ b/src/commandhandler.h @@ -304,6 +304,8 @@ class CommandHandler void handleDumpTests(const std::string &args, ChatTab *tab); + void handleDumpOGL(const std::string &args, ChatTab *tab); + void outString(ChatTab *tab, const std::string &str, const std::string &def); diff --git a/src/gui/chatwindow.cpp b/src/gui/chatwindow.cpp index ac493b04e..eb8669223 100644 --- a/src/gui/chatwindow.cpp +++ b/src/gui/chatwindow.cpp @@ -307,6 +307,7 @@ void ChatWindow::fillCommands() mCommands.push_back("/serverunignoreall"); mCommands.push_back("/dumpg"); mCommands.push_back("/dumpt"); + mCommands.push_back("/dumpogl"); mCommands.push_back("/pseudoaway "); mCommands.push_back(""); mCommands.push_back(""); diff --git a/src/openglgraphics.cpp b/src/openglgraphics.cpp index d972a738f..14d525163 100644 --- a/src/openglgraphics.cpp +++ b/src/openglgraphics.cpp @@ -1351,4 +1351,24 @@ inline void OpenGLGraphics::drawLineArrayf(int size) glDrawArrays(GL_LINES, 0, size / 2); } +void OpenGLGraphics::dumpSettings() +{ + GLint test[1000]; + logger->log("\n\n"); + logger->log("start opengl dump"); + for (int f = 0; f < 65535; f ++) + { + test[0] = 0; + test[1] = 0; + test[2] = 0; + test[3] = 0; + glGetIntegerv(f, &test[0]); + if (test[0] || test[1] || test[2] || test[3]) + { + logger->log("%d = %d, %d, %d, %d", f, test[0], test[1], test[2], test[3]); + } + } + logger->log("end opengl dump\n\n"); +} + #endif // USE_OPENGL diff --git a/src/openglgraphics.h b/src/openglgraphics.h index 9eeb530ac..02d628af0 100644 --- a/src/openglgraphics.h +++ b/src/openglgraphics.h @@ -131,6 +131,8 @@ class OpenGLGraphics : public Graphics void drawLineArrayf(int size); + static void dumpSettings(); + /** * Takes a screenshot and returns it as SDL surface. */ -- cgit v1.2.3-70-g09d2