Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "include/glad/glad.h"
- #include "GLFW/glfw3.h"
- #include <iostream>
- #include <cstddef>
- #include <string_view>
- void error_callback(int error, const char *msg) {
- std::string_view error_msg(msg);
- std::cerr << "[" << error << "]" << error_msg << "\n";
- }
- int main() {
- glfwSetErrorCallback(error_callback);
- if (glfwInit() == GL_FALSE) {
- std::cout << "Failed to initialize GLFW, check your drivers!" << std::endl;
- return EXIT_FAILURE;
- } else {
- glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
- glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 5);
- glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
- }
- GLFWwindow *window = glfwCreateWindow(800, 600, "Hello, World", NULL, NULL);
- if (window == nullptr) {
- std::cout << "Failed to create window" << std::endl;
- glfwTerminate();
- return EXIT_FAILURE;
- }
- glfwMakeContextCurrent(window);
- return EXIT_SUCCESS;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement