Changeset c8c6da8 in opengl-game for vulkan-game.cpp


Ignore:
Timestamp:
Aug 21, 2019, 8:19:09 PM (5 years ago)
Author:
Dmitry Portnoy <dmitry.portnoy@…>
Branches:
feature/imgui-sdl, master, points-test
Children:
e5d4aca
Parents:
ad31ec7
Message:

Create the overlay texture using different flags based on the SDL version (2.0.9 vs 2.0.10) and change compile.sh to compile all .vert and .frag files inside the shaders folder

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vulkan-game.cpp

    rad31ec7 rc8c6da8  
    164164   private:
    165165      GameGui* gui = new GameGui_SDL();
     166      SDL_version sdlVersion;
    166167      SDL_Window* window = nullptr;
    167168
     
    260261         }
    261262
    262          uiOverlay = SDL_CreateTexture(gRenderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, SCREEN_WIDTH, SCREEN_HEIGHT);
     263         SDL_VERSION(&sdlVersion);
     264
     265         // In SDL 2.0.10 (currently, the latest), SDL_TEXTUREACCESS_TARGET is required to get a transparent overlay working
     266         // However, the latest SDL version available through homebrew on Mac is 2.0.9, which requires SDL_TEXTUREACCESS_STREAMING
     267         // I tried building sdl 2.0.10 (and sdl_image and sdl_ttf) from source on Mac, but had some issues, so this is easier
     268         // until the homebrew recipe is updated
     269         if (sdlVersion.major == 2 && sdlVersion.minor == 0 && sdlVersion.patch == 9) {
     270            uiOverlay = SDL_CreateTexture(gRenderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_STREAMING, SCREEN_WIDTH, SCREEN_HEIGHT);
     271         } else {
     272            uiOverlay = SDL_CreateTexture(gRenderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, SCREEN_WIDTH, SCREEN_HEIGHT);
     273         }
     274
    263275         if (uiOverlay == nullptr) {
    264276            cout << "Unable to create blank texture! SDL Error: " << SDL_GetError() << endl;
     
    18331845         createRenderPass();
    18341846
    1835          createGraphicsPipeline("shaders/vert.spv", "shaders/frag.spv", scenePipeline);
    1836          createGraphicsPipeline("shaders/vert.spv", "shaders/frag.spv", overlayPipeline);
     1847         createGraphicsPipeline("shaders/scene-vert.spv", "shaders/scene-frag.spv", scenePipeline);
     1848         createGraphicsPipeline("shaders/overlay-vert.spv", "shaders/overlay-frag.spv", overlayPipeline);
    18371849
    18381850         createDepthResources();
Note: See TracChangeset for help on using the changeset viewer.