I found out that my program - which only draw two pictures on the screen - runs at 200FPS. 200FPS is really low number at this point of development! It does not matter if I remove all textures and other data.
The slow part of code are SDL_RenderPresent and SDL_RenderClear. Without them, the program runs at about 300K FPS. Could you tell me where could be the problem?
Window and Renderer
Code:
_window = SDL_CreateWindow( “Window”, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 800, 600, 0 );
if ( _window == NULL ) {
std::cout << "CreateWindow problem: " << SDL_GetError() << std::endl;
}
_renderer = SDL_CreateRenderer( _window, -1, SDL_RENDERER_ACCELERATED );
if ( _renderer == NULL ) {
std::cout << "CreateRenderer problem: " << SDL_GetError() << std::endl;
}
Acording to SDL_RendererInfo only two flags are used - SDL_RENDERER_ACCELERATED and SDL_RENDERER_TARGETTEXTURE.
The main loop code
http://pastebin.com/fHdVDEsb
Timer class code
http://lazyfoo.net/SDL_tutorials/lesson12/index.php
Thank you for help------------------------
I’m SDL newbie