This repository has been archived on 2024-12-30. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
2024CG-project-render/include/print_opengl_info.h
github-classroom[bot] 686dcaf351
Initial commit
2024-11-29 09:50:03 +00:00

21 lines
770 B
C

#ifndef PRINT_OPENGL_INFO_H
#define PRINT_OPENGL_INFO_H
// Use glfw to print information about the current opengl context
// Should be called after glfwMakeContextCurrent(...)
void print_opengl_info(GLFWwindow * window);
// Implementation
#include <cstdio>
void print_opengl_info(GLFWwindow * window)
{
int major, minor, rev;
major = glfwGetWindowAttrib(window, GLFW_CONTEXT_VERSION_MAJOR);
minor = glfwGetWindowAttrib(window, GLFW_CONTEXT_VERSION_MINOR);
rev = glfwGetWindowAttrib(window, GLFW_CONTEXT_REVISION);
printf("OpenGL version recieved: %d.%d.%d\n", major, minor, rev);
printf("Supported OpenGL is %s\n", (const char*)glGetString(GL_VERSION));
printf("Supported GLSL is %s\n", (const char*)glGetString(GL_SHADING_LANGUAGE_VERSION));
}
#endif