Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <SDL.h>
- #include <SDL_opengl.h>
- int main ()
- {
- if ( SDL_Init( SDL_INIT_EVERYTHING ) < 0 )
- return 1;
- atexit( SDL_Quit );
- SDL_Window *pWindow = nullptr;
- SDL_GLContext pGLContext = nullptr;
- pWindow = SDL_CreateWindow( "SDLTest", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 800, 600, SDL_WINDOW_SHOWN | SDL_WINDOW_OPENGL );
- if ( pWindow == nullptr )
- {
- std::cout << SDL_GetError() << std::endl;
- return 1;
- }
- pGLContext = SDL_GL_CreateContext( pWindow );
- if ( pGLContext == nullptr )
- {
- std::cout << SDL_GetError() << std::endl;
- return 1;
- }
- SDL_GL_SetSwapInterval( 0 );
- SDL_Event event;
- bool bDone = false;
- while ( !bDone )
- {
- while ( SDL_PollEvent( &event ) )
- {
- if ( event.type == SDL_QUIT )
- bDone = true;
- }
- glClear( GL_COLOR_BUFFER_BIT );
- SDL_GL_SwapWindow( pWindow );
- }
- SDL_GL_DeleteContext( pGLContext );
- SDL_DestroyWindow( pWindow );
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement