Advertisement
Equite

Display File [CPP]

Jun 15th, 2018
270
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.91 KB | None | 0 0
  1. #include "Display.hpp"
  2.  
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #include <GL/GLEW.h>
  6. #include <GLFW/glfw3.h>
  7. #include <glm/glm.hpp>
  8.  
  9. namespace glm {
  10.     Display::Display(int width, int height, const char* title) {
  11.         //Initialize GLFW
  12.         glewExperimental = true;
  13.         if(!glfwInit()){
  14.             fprintf(stderr, "Failed to initialize GLFW!\n");
  15.         }
  16.  
  17.         glfwWindowHint(GLFW_SAMPLES, 2);
  18.         glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
  19.         glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
  20.         glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
  21.         glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
  22.  
  23.         GLFWwindow* window;
  24.         window = glfwCreateWindow(width, height, title, NULL, NULL);
  25.         if(window==NULL){
  26.             fprintf(stderr, "Failed to create window!\n");
  27.         }
  28.  
  29.         glfwMakeContextCurrent(window);
  30.         glewExperimental=true;
  31.         if (glewInit() != GLEW_OK) {
  32.             fprintf(stderr, "Failed to initialize GLEW!\n");
  33.         }
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement