add dump function

This commit is contained in:
Rubbit 2024-04-27 06:58:50 +08:00
parent f06951f16c
commit 50e5c80e5b
1 changed files with 32 additions and 0 deletions

View File

@ -391,3 +391,35 @@ void scroll_callback(GLFWwindow *window, double xoffset, double yoffset)
{
camera.ProcessMouseScroll(static_cast<float>(yoffset));
}
void glfwDump(GLFWwindow *window){
int clientAPI = glfwGetWindowAttrib(window, GLFW_CLIENT_API);
int contextAPI = glfwGetWindowAttrib(window, GLFW_CONTEXT_CREATION_API);
int contextVersionMajor = glfwGetWindowAttrib(window, GLFW_CONTEXT_VERSION_MAJOR);
int contextVersionMinor = glfwGetWindowAttrib(window, GLFW_CONTEXT_VERSION_MINOR);
int profile = glfwGetWindowAttrib(window, GLFW_OPENGL_PROFILE);
int robustness = glfwGetWindowAttrib(window, GLFW_CONTEXT_ROBUSTNESS);
int releaseBehavior = glfwGetWindowAttrib(window, GLFW_CONTEXT_RELEASE_BEHAVIOR);
int forwardCompat = glfwGetWindowAttrib(window, GLFW_OPENGL_FORWARD_COMPAT);
int debugContext = glfwGetWindowAttrib(window, GLFW_OPENGL_DEBUG_CONTEXT);
int windowSizeWidth, windowSizeHeight;
glfwGetWindowSize(window, &windowSizeWidth, &windowSizeHeight);
int bufferSizeWidth, bufferSizeHeight;
glfwGetFramebufferSize(window, &bufferSizeWidth, &bufferSizeHeight);
float windowScaleX, windowScaleY;
glfwGetWindowContentScale(window, &windowScaleX, &windowScaleY);
std::cout << "Client API: " << clientAPI << std::endl;
std::cout << "Context API: " << contextAPI << std::endl;
std::cout << "OpenGL version: " << contextVersionMajor << "." << contextVersionMinor << std::endl;
std::cout << "OpenGL profile: " << profile << std::endl;
std::cout << "Robustness: " << robustness << std::endl;
std::cout << "Release behavior: " << releaseBehavior << std::endl;
std::cout << "Forward compatibility: " << forwardCompat << std::endl;
std::cout << "Debug context: " << debugContext << std::endl;
std::cout << "Window size: " << " width-" << windowSizeWidth << " height-" << windowSizeHeight << std::endl;
std::cout << "FrameBuffer size: " << " width-" << bufferSizeWidth << " height-" << bufferSizeHeight << std::endl;
std::cout << "Window Scale: " << " X-" << bufferSizeWidth << " Y-" << bufferSizeHeight << std::endl;
}