Advertisement
Guest User

Untitled

a guest
Dec 7th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. #include <unistd.h>
  2. #include <stdio.h>
  3. #include <SDL.h>
  4. #include <SDL_opengl.h>
  5.  
  6. int main(void)
  7. {
  8. if(SDL_Init(SDL_INIT_VIDEO) == -1)
  9. {
  10. printf("SDL_Init() failed\n");
  11. SDL_Quit();
  12. exit(1);
  13. }
  14.  
  15. SDL_Window *gl_window = SDL_CreateWindow("Test Window", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 200, 100, SDL_WINDOW_OPENGL|SDL_WINDOW_RESIZABLE);
  16. if (gl_window == NULL)
  17. {
  18. printf("SDL_CreateWindow() failed\n");
  19. SDL_Quit();
  20. exit(1);
  21. }
  22.  
  23. SDL_GLContext gl_context = SDL_GL_CreateContext(gl_window);
  24. if (gl_context == NULL)
  25. {
  26. printf("SDL_CreateWindow() failed\n");
  27. SDL_Quit();
  28. exit(1);
  29. }
  30.  
  31. const char* my_string = (const char*) glGetString (GL_VENDOR);
  32. if (my_string == NULL)
  33. {
  34. printf("glGetString() failed\n");
  35. SDL_Quit();
  36. exit(1);
  37. }
  38.  
  39. printf("Got string [%s]\n", my_string);
  40. printf("Sleeping....\n");
  41.  
  42. sleep(5);
  43. return 0;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement