OpenGL getters
This commit is contained in:
42
main.cpp
42
main.cpp
@@ -7,7 +7,22 @@
|
||||
#include "JGL/types/Shader.h"
|
||||
#include <ReWindow/Logger.h>
|
||||
|
||||
std::vector<std::string> string_expand(const std::string& input, char delimiter = ' ')
|
||||
|
||||
std::vector<std::string> string_expand(const std::string& input, char delimiter = ' ');
|
||||
|
||||
|
||||
#pragma region OpenGL Introspection
|
||||
|
||||
inline std::string GetGLVendor() { return {(const char*)glGetString(GL_VENDOR)}; }
|
||||
inline std::string GetGLRenderer() { return {(const char*)glGetString(GL_RENDERER)}; }
|
||||
inline std::string GetGLVersion() { return {(const char*)glGetString(GL_VERSION)}; }
|
||||
inline std::string GetGLSLVersion() { return {(const char*)glGetString(GL_SHADING_LANGUAGE_VERSION)}; }
|
||||
inline std::string GetGLExtensions() { return {(const char*)glGetString(GL_EXTENSIONS)}; }
|
||||
inline std::vector<std::string> GetGLExtensionList() { return string_expand({(const char*)glGetString(GL_EXTENSIONS)}); }
|
||||
|
||||
#pragma endregion
|
||||
|
||||
std::vector<std::string> string_expand(const std::string& input, char delimiter)
|
||||
{
|
||||
std::vector<std::string> result;
|
||||
std::stringstream ss (input);
|
||||
@@ -135,6 +150,9 @@ public:
|
||||
if (!JGL::Init(vec_size, 0.f, 1.f))
|
||||
return false;
|
||||
JGL::Update(vec_size);
|
||||
|
||||
|
||||
|
||||
glClearColor(0.f, 0.f, 0.f, 0.f);
|
||||
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
@@ -149,6 +167,28 @@ public:
|
||||
canvas = new RenderTarget(vec_size);
|
||||
LoadShader("test");
|
||||
|
||||
console->Log(std::format("OpenGL Renderer: {}", GetGLRenderer()));
|
||||
console->Log(std::format("OpenGL Vendor: {}", GetGLVendor()));
|
||||
console->Log(std::format("OpenGL Version: {}", GetGLVersion()));
|
||||
console->Log(std::format("GLSL Version: {}", GetGLSLVersion()));
|
||||
auto ext_list = GetGLExtensionList();
|
||||
|
||||
// TODO: output 3 at a time.
|
||||
console->Log("GL-Extensions: ");
|
||||
std::string formatted_output = "";//"GL-Extensions: {}";
|
||||
|
||||
|
||||
int iter = 0;
|
||||
for (auto& str : ext_list) {
|
||||
formatted_output += str + ", ";
|
||||
iter++;
|
||||
if (iter > 5) {
|
||||
iter = 0;
|
||||
console->Log(formatted_output);
|
||||
formatted_output = "";
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
void PropagateWindowSize() {
|
||||
|
Reference in New Issue
Block a user