// Set minimum requirements for OpenGL 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, 8); SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); // Set video options to pass to SDL VIDEO subsystem. int iVideoFlags = SDL_OPENGL | SDL_HWPALETTE; if(Fullscreen) { iVideoFlags = SDL_OPENGL | SDL_HWPALETTE | SDL_FULLSCREEN; } std::cout << "Initializing OpenGL.. "; if(SDL_SetVideoMode(ScreenWidth, ScreenHeight, pVideoInfo->vfmt->BitsPerPixel, iVideoFlags)) { std::cout << "OK.\n"; // Set a black background. glClearColor(0.0f, 0.0f, 0.0f, 0); // ?????????????????? glMatrixMode(GL_PROJECTION); glLoadIdentity(); // Create an OpenGL Viewport in a 2d Plane glViewport(0, 0, ScreenWidth, ScreenHeight); glOrtho(0, ScreenWidth, ScreenHeight, 0, 0, 128); // ?????????????????? glMatrixMode(GL_MODELVIEW); glLoadIdentity(); // Enable 2D textures and configure some blending options. glEnable(GL_TEXTURE_2D); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); }