OpenGL ES how starts?

Hi!
I am newbie in programming. I would create simple turned game on android. Unfortunately I stopped my work on create a struct of program. I not understand why no detect finger events. I programming without console interpreter (ide on android i waiting for update)

Fragment my code is here:

SDL_Window *window;
SDL_Event event;
vec2i screenSize;

camera *cam;
Engine *engine;
Map *map;
touch *touches;

void programInit()
{
	screenSize = vec2i(2640, 1200);
	
	SDL_Init(SDL_INIT_EVERYTHING);	
	// We use OpenGL ES 2.0
	SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2);
	SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);

	// We want at least 8 bits per color
	SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
	SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
	SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);	

	window = SDL_CreateWindow(
		"myGame", 
		SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 
		screenSize.x, screenSize.y, 
		SDL_WINDOW_OPENGL
		);
	
	// We will not actually need a context created, but we should create one
	SDL_GL_CreateContext(window);	
}

int main(int argc, char *argv[])
{
	
	programInit();
	triangle_init();  // init to drawTriangles
	
	initTournament();	// init Game
	
	while (isTournament !=  false)
	{
		while (SDL_PollEvent(&event))
		{
			vec2f pos;
			// touches
			if(event.type == SDL_FINGERDOWN )
			{
				pos.x = event.tfinger.x;
				pos.y = event.tfinger.y;
				touches ->add(pos, screenSize);
				cam->move(touches->getDelta());
			}
			else if(event.type == SDL_FINGERMOTION)
			{
				pos.x = event.tfinger.x;
				pos.y = event.tfinger.y;
				touches ->add(pos, screenSize);
				cam->move(touches->getDelta());
			}
			else if(event.type == SDL_FINGERUP)
			{
				pos.x = event.tfinger.x;
				pos.y = event.tfinger.y;
				touches ->add(pos, screenSize);
				cam->move(touches->getDelta());
			}
			
		};
		
		engine->start();
		map->draw(engine);
			
	};
	
	programEnd();
	return 0;
}

I think the issue is that SDL transforms finger events into mouse events by default. I usually put

#if SDL_VERSION_ATLEAST(2, 0, 10)
	SDL_SetHint(SDL_HINT_MOUSE_TOUCH_EVENTS, "0");
	SDL_SetHint(SDL_HINT_TOUCH_MOUSE_EVENTS, "0");
#else
	SDL_SetHint(SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH, "1");
#endif

at the start of the program to keep the mouse and finger events separated.

This is a compile-time test so may not do what you want if you are linking to a shared library at runtime (e.g. SDL2.dll in Windows or libSDL2.so in Linux). In that case you probably want to use SDL_GetVersion().

This is a compile-time test so may not do what you want if you are linking to a shared library at runtime (e.g. SDL2.dll in Windows or libSDL2.so in Linux).

Maybe not on Linux (where you may wanna use the system libsdl2 that might be older), but on Windows (or also macOS) where you bundle SDL2.dll (or equivalent) with your software that kind of compile-time check is totally fine.

Doing a runtime check is certainly a good idea on a Linux system where you decide to depend on globally installed libraries. However if you bundle the program in something like an AppImage or have the user compile the whole program from the AUR, then I think compile time checks are fine. You can easily do version checks during runtime, but if the compiler runs into undefined symbols, then you’re screwed and have to edit the source files. I believe the approach here depends on how you want to distribute your software.

Even then, ensuring that the version of SDL2.dll that you bundle with your app is always the same as the version tested at compile time requires care. In my development environment (mingw) it’s not automatic.

Anyway, since you need to do the test at runtime in the case of Linux, you might as well do it at runtime on all platforms and eliminate the risk of a problem.