day-night loop, dynamic skybox, clock on debug panel

This commit is contained in:
MihailRis
2023-11-28 11:01:22 +03:00
parent 4a9a4ddd14
commit c08c31b0ad
24 changed files with 599 additions and 48 deletions
+9
View File
@@ -127,6 +127,10 @@ int Window::initialize(DisplaySettings& settings){
glfwSetWindowMonitor(window, monitor, 0, 0, mode->width, mode->height, GLFW_DONT_CARE);
}
glfwSwapInterval(settings.swapInterval);
const GLubyte* vendor = glGetString(GL_VENDOR);
const GLubyte* renderer = glGetString(GL_RENDERER);
std::cout << "GL Vendor: " << (char*)vendor << std::endl;
std::cout << "GL Renderer: " << (char*)renderer << std::endl;
return 0;
}
@@ -134,6 +138,10 @@ void Window::clear() {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
}
void Window::clearDepth() {
glClear(GL_DEPTH_BUFFER_BIT);
}
void Window::setBgColor(glm::vec3 color) {
glClearColor(color.r, color.g, color.b, 1.0f);
}
@@ -252,6 +260,7 @@ DisplaySettings* Window::getSettings() {
ImageData* Window::takeScreenshot() {
ubyte* data = new ubyte[width * height * 3];
glPixelStorei(GL_PACK_ALIGNMENT, 1);
glReadPixels(0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE, data);
return new ImageData(ImageFormat::rgb888, width, height, data);
}