Added color

This commit is contained in:
Robert 2021-01-19 19:25:46 +01:00
commit c40a38253d
13 changed files with 8300 additions and 0 deletions

52
examples/debug/main.cpp Normal file
View file

@ -0,0 +1,52 @@
#include <iostream>
#include "openglu.hpp"
#include <glad/glad.h>
#include <GLFW/glfw3.h>
void framebuffer_size_callback(GLFWwindow* window, int width, int height)
{
oglu::SetViewport(0, 0, width, height);
}
void processInput(GLFWwindow* window)
{
if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)
glfwSetWindowShouldClose(window, true);
}
int main(int argc, char** argv)
{
glfwInit();
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 6);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
const GLFWvidmode* screen = glfwGetVideoMode(glfwGetPrimaryMonitor());
int windowSize = screen->height / 4 * 3;
GLFWwindow* window = glfwCreateWindow(windowSize, windowSize, "Debug", NULL, NULL);
if (window == nullptr)
{
std::cerr << "Failed to create GLFW window" << std::endl;
glfwTerminate();
return -1;
}
glfwMakeContextCurrent(window);
oglu::LoadGLLoader((GLADloadproc)glfwGetProcAddress);
oglu::SetViewport(0, 0, windowSize, windowSize);
while (!glfwWindowShouldClose(window))
{
processInput(window);
oglu::ClearScreen(GL_COLOR_BUFFER_BIT, oglu::Color(0.29f, 0.13f, 0.23f));
glfwSwapBuffers(window);
glfwPollEvents();
}
glfwTerminate();
return 0;
}