SDL 2.0.10 Crash Setting OpenGL Window Android Studio

Hello people’s.

I’m trying port my old SDL game that used 2.0.early version to 2.0.10 so I can get 64bit binarys. But When it comes to setting up the Window it crash’s . I’m not sure if It’s SDL with it’s threads, new NDK’s.

When I call Init3D() Function, inside my Display Object it’s supposed to setup the Window.

I have a game object, and I placed inside it a display object.

from main loop, I create the game object, then call a function inside the game object, then inside I enabled Init3D(); then it crash’s.

If I set all the variables and code in the main loop (main.cpp) and call the same code it works. Yet inside the Display object it fails.

bool Display::Init3D()
{
//SDL_INIT_EVERYTHING

//SDL_Init( SDL_INIT_GAMECONTROLLER );

//Initialize all SDL subsystems
if (SDL_Init(SDL_INIT_EVERYTHING) == -1)
{
}
 //SDL_JoystickEventState( SDL_ENABLE );


//GETS SCREEN AND SIZE AND SETS IT
SDL_DisplayMode mode;
if( SDL_GetCurrentDisplayMode(0, &mode) == 0)
{
    SCREEN_WIDTH  = mode.w;
    SCREEN_HEIGHT = mode.h;

    SCREEN_WIDTHf  = mode.w;
    SCREEN_HEIGHTf = mode.h;

    fRatio = SCREEN_WIDTHf / SCREEN_HEIGHTf;

    fw = SCREEN_WIDTHf / SCREEN_HEIGHTf;
    //fRatio = 2.5;
}


//SCREEN_WIDTH = 480;
//SCREEN_HEIGHT = 320;

//fRatio = fRatio;

//SDL_Window *win;
win = SDL_CreateWindow("Hello World!", 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_OPENGL);
glcontext = SDL_GL_CreateContext(win);

//glViewport( 0.f, 0.f, SCREEN_WIDTH, SCREEN_HEIGHT );
//Initialize Projection Matrix
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
//glOrthof( 0.0, SCREEN_WIDTH, SCREEN_HEIGHT, 0.0, 0.0, 1.0 );
glFrustumf(-fRatio,  fRatio, -1, 1, 1, 10000); //10000
//glFrustumf(-fRatio, fRatio, -fh, fh, 1, 2500); //10000
//glFrustumf(-fw, fw, -fh, fh, zNear, zFar);
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();

}