Can't get a GLES context on Tegra devices


#1

I started porting my game on Android, using SDL2 and gl4es (https://github.com/ptitSeb/gl4es) which is a very nice library which will emulate a GL 1.x context on GLES.

In either case, everything works very well on most of the Android devices, except for Nexus 7 2012 (and possibly other Tegra ones), where it fails to create a suitable context. I don’t have any Tegra device, so I can’t test things directly, but I was wondering if there is anything obviously wrong with my settings:

(values for rgb are 8 for each)

	SDL_GL_SetAttribute( SDL_GL_RED_SIZE, rgb_size[0] );
	SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, rgb_size[1] );
	SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, rgb_size[2] );

	SDL_GL_SetAttribute( SDL_GL_ALPHA_SIZE, 0 );
	SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 24 );
	SDL_GL_SetAttribute( SDL_GL_STENCIL_SIZE, 8 );
	SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );

	el_gl_window = SDL_CreateWindow("Eternal Lands", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 1, 1, SDL_WINDOW_OPENGL|SDL_WINDOW_FULLSCREEN_DESKTOP|SDL_WINDOW_ALLOW_HIGHDPI);
	if(!el_gl_window)
    	{
			LOG_ERROR("%s: %s\n", fail_opengl_mode, SDL_GetError());
			SDL_Quit();
			exit(1);
    	}

#2

oh, and I forgot to mention, I am trying to get a GLES 1.x context, I commented out the GLES 2 stuff in SDL


#3

Well, it turns out it was the depth buffer. For some reason, at least some Tegra devices didn’t like 24 bits. It works fine with 16 though.