Advertisement
Noah-Huppert

glload and glfw errors

Jul 16th, 2014
329
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.11 KB | None | 0 0
  1. //ERROR: INCLUDING glload HEADERS IN THE SAME FILE AS glfw HEADERS CAUSES exit AND CONSTANTS LIKE gl_true AND g_falure TO BE UNDEFINED
  2. #include "glload\gl_all.hpp"
  3. #include "glload\gl_load.hpp"
  4.  
  5. #include "GLFW\glfw3.h"
  6.  
  7. #include <stdio.h>
  8.  
  9. static void error_callback(int error, const char* desc){
  10.     fputs(desc, stderr);
  11. }
  12.  
  13. static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods){
  14.     if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS)
  15.         glfwSetWindowShouldClose(window, GL_TRUE);
  16. }
  17.  
  18. int main(void){
  19.     GLFWwindow * window;
  20.    
  21.     glfwSetErrorCallback(error_callback);
  22.  
  23.     if (!glfwInit()){
  24.         exit(EXIT_FAILURE);
  25.     }
  26.  
  27.     window = glfwCreateWindow(640, 480, "A Window", NULL, NULL);
  28.  
  29.     if (!window){
  30.         glfwTerminate();
  31.         exit(EXIT_FAILURE);
  32.     }
  33.  
  34.     glfwMakeContextCurrent(window);
  35.  
  36.     glfwSetKeyCallback(window, key_callback);
  37.  
  38.     glload::LoadTest loadTest = glload::LoadFunctions();
  39.     if (!loadTest){
  40.         glfwTerminate();
  41.         exit(EXIT_FAILURE);
  42.     }
  43.  
  44.     while (!glfwWindowShouldClose(window)){
  45.         glfwPollEvents();
  46.     }
  47.  
  48.     glfwDestroyWindow(window);
  49.  
  50.     glfwTerminate();
  51.     exit(EXIT_SUCCESS);
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement