Cleanup extension detecting code

This commit is contained in:
mrkubax10 2023-05-13 21:08:28 +02:00
parent 905019db00
commit 854143a980

View File

@ -31,6 +31,14 @@ SOFTWARE.
#include "common/logger.hpp"
static void is_extension_supported(const std::string& name, const std::string& display_name, bool& output) {
output = glfwExtensionSupported(name.c_str());
if(output)
LOG_INFO("%s are supported by GPU", display_name.c_str());
else
LOG_INFO("%s aren't supported by GPU", display_name.c_str());
}
bool GLEW_ARB_vertex_array_object;
bool GLEW_ARB_framebuffer_object;
@ -76,16 +84,8 @@ PFNGLACTIVETEXTUREPROC glActiveTexture;
#endif
void polygun::opengl::init() {
GLEW_ARB_vertex_array_object = glfwExtensionSupported("GL_ARB_vertex_array_object");
if(GLEW_ARB_vertex_array_object)
LOG_INFO("Vertex Array Objects are supported by GPU");
else
LOG_INFO("Vertex Array Objects aren't supported by GPU");
GLEW_ARB_framebuffer_object = glfwExtensionSupported("GL_ARB_framebuffer_object");
if(GLEW_ARB_vertex_array_object)
LOG_INFO("Framebuffer Objects are supported by GPU");
else
LOG_INFO("Framebuffer Objects aren't supported by GPU");
is_extension_supported("GL_ARB_vertex_array_object", "Vertex Array Objects", GLEW_ARB_vertex_array_object);
is_extension_supported("GL_ARB_framebuffer_object", "Framebuffer Objects", GLEW_ARB_framebuffer_object);
glGenVertexArrays = (PFNGLGENVERTEXARRAYSPROC)glfwGetProcAddress("glGenVertexArrays");
glDeleteVertexArrays = (PFNGLDELETEVERTEXARRAYSPROC)glfwGetProcAddress("glDeleteVertexArrays");