Added color
This commit is contained in:
commit
c40a38253d
13 changed files with 8300 additions and 0 deletions
16
examples/debug/CMakeLists.txt
Normal file
16
examples/debug/CMakeLists.txt
Normal file
|
@ -0,0 +1,16 @@
|
|||
add_executable(debug "main.cpp")
|
||||
|
||||
find_package(glfw3 REQUIRED)
|
||||
|
||||
target_include_directories(debug PRIVATE
|
||||
glfw
|
||||
)
|
||||
|
||||
target_link_libraries(debug PRIVATE
|
||||
"$<TARGET_FILE_DIR:openglu>/$<TARGET_FILE_BASE_NAME:openglu>.lib"
|
||||
glfw
|
||||
)
|
||||
|
||||
add_custom_command(TARGET debug POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:openglu> $<TARGET_FILE:glfw> $<TARGET_FILE_DIR:debug>
|
||||
)
|
52
examples/debug/main.cpp
Normal file
52
examples/debug/main.cpp
Normal 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;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue