Skip to content

Instantly share code, notes, and snippets.

@taesiri
Last active August 29, 2015 13:57
Show Gist options
  • Save taesiri/9543436 to your computer and use it in GitHub Desktop.
Save taesiri/9543436 to your computer and use it in GitHub Desktop.
SDL2 Basic OpenGL Window
# Compile Command
# Mac Os X
g++ source.cpp -L/usr/local/lib -lSDL2
^
Link to Library Directory
# SDL2 Installation using brew
brew install sdl2
brew link sdl2
#include <SDL2/SDL.h>
#include <stdio.h>
int main(int argc, char* argv[]) {
SDL_Window *window;
SDL_Init(SDL_INIT_VIDEO);
window = SDL_CreateWindow("SDL Window",
SDL_WINDOWPOS_UNDEFINED,
SDL_WINDOWPOS_UNDEFINED,
640, 480,
SDL_WINDOW_OPENGL);
if(window == NULL) {
printf("Could not initialize Window %s/n", SDL_GetError());
return 1;
}
SDL_Delay(3000);
SDL_DestroyWindow(window);
SDL_Quit();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment