i am trying to use SDL2 and OpenGL on mac osx yosemite, i have followed the example on SDL page and also the example from Lazy Foo's Page <http://lazyfoo.net/tutorials/SDL/50_SDL_and_opengl_2/index.php> but everytime i run the code, i get the same result, a blank window with black background, i have searched on google for a while now, but ive still not gotten any solution, i'd appreciate any help

Below is my code

```
/*
 * Main.cpp
 *
 *  Created on: Sep 15, 2015
 *      Author: Damian-Machine
 */
#include <OpenGL/gl.h>
#include <OpenGL/glu.h>
#include<SDL.h>
#include<SDL_opengl.h>
#include <stdio.h>
#include <string>
#include<iostream>
#define SCREEN_WIDTH 640
#define SCREEN_HEIGHT 480

bool init();

bool initGL();

void handleKeys(unsigned char key, int x, int y);

void update();

void render();

void close();

SDL_Window *gWindow = NULL;

SDL_GLContext gContext;

bool gRenderQuad = true;

int main(){
    SDL_Event e;
    bool quit = false;
    if(!init()){
        printf("Failed to initialize!\n");
        return 0;
    }
    SDL_StartTextInput();

    while(!quit){
        while(SDL_PollEvent(&e) !=0){
            if(e.type == SDL_QUIT){
                quit = true;
            }else if (e.type == SDL_TEXTINPUT){
                int x = 0, y = 0;
                SDL_GetMouseState(&x, &y);
                handleKeys(e.text.text[0], x, y);
            }

        }

        render();
    }

    SDL_StopTextInput();

    close();
}

bool init(){
    bool success = true;
    if(SDL_Init(SDL_INIT_VIDEO) < 0){
        printf("SDL could not initialize! SDL Error: %s\n", SDL_GetError());
        success = false;
    }else{
        printf("SDL Opengl context created successfully\n");
        SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
        SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 4);
        SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1);

        printf("Checking failed status: %s\n", SDL_GetError());

        //Create window
        gWindow = SDL_CreateWindow( "SDL Tutorial", SDL_WINDOWPOS_UNDEFINED,
                SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_OPENGL);

        //std::cout << "OpenGL version " << glGetString​(GL_VERSION​) << std::endl;
      //std::cout << "GLSL version " << glGetString​(GL_SHADING_LANGUAGE_VERSION​​) << std::endendl;
        if( gWindow == NULL )
        {
            printf( "Window could not be created! SDL Error: %s\n", SDL_GetError() );
            success = false;
        }else { //Create context
            gContext = SDL_GL_CreateContext( gWindow );
            if( gContext == NULL ) {
                printf( "OpenGL context could not be created! SDL Error: %s\n", SDL_GetError() );
                success = false;
            } else { //Use Vsync
                if( SDL_GL_SetSwapInterval( 1 ) < 0 ) {
                    printf( "Warning: Unable to set VSync! SDL Error: %s\n", SDL_GetError() );
                } //Initialize OpenGL
                if( !initGL() ) {
                    printf( "Unable to initialize OpenGL!\n" ); success = false;
                }
            }
        }
    }
    return success;
}

bool initGL(){
    bool success = true;

    GLenum error = GL_NO_ERROR;
    glViewport(0, 0, SCREEN_WIDTH,SCREEN_HEIGHT);
    glEnable(GL_BLEND);
    glEnable(GL_DEPTH_TEST);

    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();

    error = glGetError();
    if(error != GL_NO_ERROR){
        printf("Error initializing OpenGL! %s\n", gluErrorString(error));
        success = false;
    }

    glShadeModel(GL_SMOOTH);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();

    error = glGetError();
    if(error != GL_NO_ERROR){
        printf("Error initializing OpenGL %s\n", gluErrorString(error));
        success = false;
    }

    glClearColor(1.f, 0.f, 0.f, 1.f);

    error = glGetError();
    if(error != GL_NO_ERROR){
        printf("Error initializing OpenGL %s\n", gluErrorString(error));
        success = false;
    }
    return success;
}

void handleKeys( unsigned char key, int x, int y ) {
    //Toggle quad
    if( key == 'q' )
    {
        gRenderQuad = !gRenderQuad;
    }
}

void update(){

}

void render(){
    glClear(GL_COLOR_BUFFER_BIT);

    if(gRenderQuad){
        glRotatef(0.4f,0.0f,1.0f,0.0f);    // Rotate The cube around the Y axis
        glRotatef(0.2f,1.0f,1.0f,1.0f);
        glColor3f(0.0f,1.0f,0.0f);
        glBegin(GL_QUADS);
            glVertex2f( -0.5f, -0.5f );
            glVertex2f( 0.5f, -0.5f );
            glVertex2f( 0.5f, 0.5f );
            glVertex2f( -0.5f, 0.5f );
        glEnd();
    }
    SDL_GL_SwapWindow(gWindow);
}

void close(){
    SDL_GL_DeleteContext(gContext);
    SDL_DestroyWindow(gWindow);
    gWindow = NULL;
    SDL_Quit();
}

```