63 lines
1.2 KiB
C++
63 lines
1.2 KiB
C++
// To compile on Windows
|
|
|
|
// Install GLFW 3.3.8
|
|
// https://www.glfw.org/download.html
|
|
// On Windows:
|
|
// extract the downloaded .zip file to "C:/libs"; this is currently expected
|
|
// by our CMakeLists.txt.
|
|
|
|
// Install CMake
|
|
// https://cmake.org/download
|
|
// Add to PATH for all users
|
|
// from project root:
|
|
// mkdir build
|
|
// cd build
|
|
// cmake ..
|
|
// cmake --build .
|
|
// The last step compiles the executable - this can also be done from Visual
|
|
// Studio
|
|
|
|
// To run in VS
|
|
// Set startup project in Solution Explorer
|
|
// Press F5 to run
|
|
//
|
|
// To compile on Arch Linux
|
|
//
|
|
// Install dependencies
|
|
// sudo pacman -S glfw mesa
|
|
//
|
|
// Build
|
|
// cmake ..
|
|
// cmake --build .
|
|
|
|
#include <GLFW/glfw3.h>
|
|
#include <GL/gl.h>
|
|
|
|
int main()
|
|
{
|
|
if (!glfwInit())
|
|
return -1;
|
|
|
|
GLFWwindow* window = glfwCreateWindow(640, 480, "Hello GL", NULL, NULL);
|
|
if (!window)
|
|
{
|
|
glfwTerminate();
|
|
return -1;
|
|
}
|
|
|
|
glfwMakeContextCurrent(window);
|
|
|
|
while (!glfwWindowShouldClose(window))
|
|
{
|
|
glClearColor(1.0f, 0.0f, 0.0f, 1.0f);
|
|
glClear(GL_COLOR_BUFFER_BIT);
|
|
|
|
glfwSwapBuffers(window);
|
|
|
|
glfwPollEvents();
|
|
}
|
|
|
|
glfwTerminate();
|
|
return 0;
|
|
}
|