Cross platform with hardware acceleration 2d c ++ app?
SDL + OpenGL. Maybe also glee or glew if you use shaders and / or extensions. Glee is easier to use, but it doesn't seem to support OpenGL versions after 3.0. You may need SDL_image to download images.
I know that OpenGL, but I can not find any tutorials on how to use it in a cross-platform manner, they are all focused on one platform.
SDL_Init(SDL_INIT_VIDEO); SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8); SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8); SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8); SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, 0);//disable vsync if (SDL_SetVideoMode(scrWidth, scrHeight, 32, SDL_OPENGL) == 0){ fprintf(stderr, "couldn't set mode %dx%d!\n", 640, 480); SDL_Quit(); return -1; } glewInit();//if you use glew, shaders, extensions. while(gameIsRunning()){//game loop glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); //OpenGL rendering here glFlush(); SDL_GL_SwapBuffers(); } SDL_Quit();
See the sdl documentation for more details.
Using SDL is also possible, but I'm afraid that the game may not work if I use it. Is this necessarily true?
If vsync is disabled, you can get from a few hundred to a thousand frames per second. The exact performance depends on the complexity of your equipment and the complexity of the scene. I had 300 frames per second for a simple 3D dungeon finder that used opengl "RAW" without displaying vertex buffer lists / objects. In addition, if you use a mechanism with a fixed frame rate or a timer, you will not receive more frames per second than you requested.
SDL was used to port Unreal 2004 to Linux. It was also used on the Linux port Doom 3 / Quake 4. Therefore, it is thoroughly tested and well known.
See this list for more details.
Sigterm
source share