Skip to content

Instantly share code, notes, and snippets.

@croepha
Created November 22, 2018 22:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save croepha/6a537b008e9e4994e1ec5f0f940cdc64 to your computer and use it in GitHub Desktop.
Save croepha/6a537b008e9e4994e1ec5f0f940cdc64 to your computer and use it in GitHub Desktop.
#include <assert.h>
#include <OpenGL/gl3.h>
#include <SDL2/SDL.h>
int main () {
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 0);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS,
SDL_GL_CONTEXT_DEBUG_FLAG |
SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3 );
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 3 );
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE );
auto window = SDL_CreateWindow("TEST",
SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
800, 600,
SDL_WINDOW_ALLOW_HIGHDPI |
SDL_WINDOW_OPENGL |
SDL_WINDOW_HIDDEN
);
assert(window);
auto gl = SDL_GL_CreateContext( window );
assert(gl);
printf("GL_VENDOR = %s\n", glGetString(GL_VENDOR));
printf("GL_RENDERER = %s\n", glGetString(GL_RENDERER));
printf("GL_VERSION = %s\n", glGetString(GL_VERSION));
printf("GL_EXTENSIONS = %s\n", glGetString(GL_EXTENSIONS));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment