Changeset cb6fabb in opengl-game


Ignore:
Timestamp:
May 1, 2021, 1:52:25 AM (3 years ago)
Author:
Dmitry Portnoy <dportnoy@…>
Branches:
feature/imgui-sdl
Children:
756162f
Parents:
4a777d2
git-author:
Dmitry Portnoy <dportnoy@…> (05/01/21 01:31:53)
git-committer:
Dmitry Portnoy <dportnoy@…> (05/01/21 01:52:25)
Message:

Update the build instructions and makefile to work with OSX again

Files:
5 edited

Legend:

Unmodified
Added
Removed
  • compile.sh

    r4a777d2 rcb6fabb  
    11# TODO: Figure out why calling this from a makefile gives an error about shopt not being found
    22
    3 # This section is left here in case there's no easy way to get glslangValidator in the path on a Mac
    4 
    53OS=$(uname)
    6 
    7 if [ $OS = "Darwin" ]; then
    8    VULKAN_SDK_PATH=/Users/dportnoy15/Development/vulkan-sdk-macos-1.1.108.0/macOS
    9 fi
    104
    115shopt -s nullglob
  • docs/README.txt

    r4a777d2 rcb6fabb  
     1--------------------
     2VULKAN INSTRUCTIOS
     3--------------------
     4
     5These are the most up-to-date instructions. Use these rather than the ones
     6listed further down, which are for the old OpenGL version of the game
     7
     8Windows
     9--------
     10
     11Create an include directory inside the opengl-game folder
     12
     13Download GLM and copy the glm folder into your include directory
     14
     15Download the 64bit pre-compiledbinaries of GLFW3
     16 - Copy lib-vc2019/glfw3.lib into your lib directory
     17 - Copy the whole include/GLFW directory into your include directory
     18
     19Download the SDL2 pre-built Windows binaries
     20 - Copy the SDL2 include folder into /include and rename it SDL2
     21 - Copy the contents of lib/x64 to lib
     22
     23Download the SDL2_image Visual C++ development libraries from https://www.libsdl.org/projects/SDL_image/
     24Download the SDL2_ttf Visual C++ development libraries from https://www.libsdl.org/projects/SDL_ttf/
     25(Might use SDL2_gfx later as well)
     26
     27Copy the 64-bit static libraries to the lib directory you created above
     28
     29TODO: Figure out how to do static compilation with SDL2
     30
     31Since I'm currently using dynamic SDL2 libraries for Windows, some DLLs from sdl2-ttf and sdl2-image
     32
     33Download the vulkan sdk
     34 - Add the location of the Include folder to the VS2019 project properties under C/C++ -> General -> Addition Include DIrectories
     35 - Add the location of the Lib folder to the VS2019 project properties under Linker -> General -> Addition Library DIrectories
     36
     37Linux:
     38--------
     39
     40Download the vulkan sdk (make sure VULKAN_SDK_PATH in the makefile points to it)
     41
     42sudo apt-get install libxcb1-dev xorg-dev libglm-dev libsdl2-dev libsdl2-image-dev libsdl2-ttf-dev
     43
     44source setup-env.sh into your current shell
     45
     46mActually, I think now this should work, after following the online instructions for installing Vulkan:
     47sudo apt-get install vulkan-sdk libsdl2-dev libsdl2-image-dev libsdl2-ttf-dev libglm-dev
     48(Follow the instructions at https://vulkan.lunarg.com/sdk/home#linux to add the latest Vulkan SDK version to apt-get)
     49(Verify that installing libvulkan-1 is not required)
     50
     51make vulkangame && ./vulkangame
     52
     53For the sfml version: (these directions need verification)
     54
     55sudo apt-get install libglm-dev libsfml-dev
     56
     57Currently, the apt-get sfml package doesn't have Vulkan support, so need to install from source as follows:
     58
     59Build the library yourself by following the instructions at https://www.sfml-dev.org/tutorials/2.5/compile-with-cmake.php
     60
     61sudo apt-get install libfreetype-dev libx11-dev libxrandr-dev libudev-dev libopengl-dev libflac-dev libogg-dev libvorbis-dev libopenal-dev libpthread-stubs0-dev
     62
     63sudo apt-get install cmake-qt-gui
     64
     65Clone the sfml repo
     66
     67OSX
     68--------
     69
     70brew install cmake pkg-config glm sdl2 sdl2_image sdl2_ttf sdl2_gfx
     71(cmake is needed for the python script mentioned below)
     72
     73Download the Vulkan SDK from https://vulkan.lunarg.com/sdk/home
     74
     75Install it by running this from inside the downloaded folder:
     76sudo ./install_vulkan.py
     77
     78make shaders
     79make vulkangame
     80./vulkangame
     81
     82
     83INSTRUCTIONS FOR THE SFML VERSION ()
     84
     85OLD INSTALL INSTRUCTIONS FOR THE OpenGL version (might no longer work)
     86-----------------------------------------------------------------------
     87
    188Installation Instructions for Linux
    289---------------------------------------
     
    47134
    48135
    49 --------------------
    50 VULKAN INSTRUCTIOS
    51 --------------------
    52 
    53 Windows
    54 --------
    55 
    56 Create an include directory inside the opengl-game folder
    57 
    58 Download GLM and copy the glm folder into your include directory
    59 
    60 Download the 64bit pre-compiledbinaries of GLFW3
    61  - Copy lib-vc2019/glfw3.lib into your lib directory
    62  - Copy the whole include/GLFW directory into your include directory
    63 
    64 Download the SDL2 pre-built Windows binaries
    65  - Copy the SDL2 include folder into /include and rename it SDL2
    66  - Copy the contents of lib/x64 to lib
    67 
    68 Download the SDL2_image Visual C++ development libraries from https://www.libsdl.org/projects/SDL_image/
    69 Download the SDL2_ttf Visual C++ development libraries from https://www.libsdl.org/projects/SDL_ttf/
    70 (Might use SDL2_gfx later as well)
    71 
    72 Copy the 64-bit static libraries to the lib directory you created above
    73 
    74 TODO: Figure out how to do static compilation with SDL2
    75 
    76 Since I'm currently using dynamic SDL2 libraries for Windows, some DLLs from sdl2-ttf and sdl2-image
    77 
    78 Download the vulkan sdk
    79  - Add the location of the Include folder to the VS2019 project properties under C/C++ -> General -> Addition Include DIrectories
    80  - Add the location of the Lib folder to the VS2019 project properties under Linker -> General -> Addition Library DIrectories
    81 
    82 Linux:
    83 --------
    84 
    85 Download the vulkan sdk (make sure VULKAN_SDK_PATH in the makefile points to it)
    86 
    87 sudo apt-get install libxcb1-dev xorg-dev libglm-dev libsdl2-dev libsdl2-image-dev libsdl2-ttf-dev
    88 
    89 source setup-env.sh into your current shell
    90 
    91 Actually, I think now this should work, after following the online instructions for installing Vulkan:
    92 sudo apt-get install vulkan-sdk libsdl2-dev libsdl2-image-dev libsdl2-ttf-dev libglm-dev
    93 (Follow the instructions at https://vulkan.lunarg.com/sdk/home#linux to add the latest Vulkan SDK version to apt-get)
    94 (Verify that installing libvulkan-1 is not required)
    95 
    96 make vulkangame && ./vulkangame
    97 
    98 For the sfml version: (these directions need verification)
    99 
    100 sudo apt-get install libglm-dev libsfml-dev
    101 
    102 Currently, the apt-get package doesn't have Vulkan support, so need to install from source as follows:
    103 
    104 Build the library yourself by following the instructions at https://www.sfml-dev.org/tutorials/2.5/compile-with-cmake.php
    105 
    106 sudo apt-get install libfreetype-dev libx11-dev libxrandr-dev libudev-dev libopengl-dev libflac-dev libogg-dev libvorbis-dev libopenal-dev libpthread-stubs0-dev
    107 
    108 sudo apt-get install cmake-qt-gui
    109 
    110 Clone the sfml repo
    111 
    112 OSX
    113 --------
    114 
    115 Download the vulkan sdk (make sure VULKAN_SDK_PATH in the makefile points to it)
    116 
    117 brew install sdl2 sdl2_image sdl2_ttf sdl2_gfx
    118 
    119 make vulkangame && ./vulkangame
    120136
    121137REFERENCE
  • game-gui-sdl.hpp

    r4a777d2 rcb6fabb  
    3535#endif
    3636
     37      SDL_Window* window;
     38
    3739   private:
    38       SDL_Window* window;
     40      // SDL_Window* window;
    3941      int windowWidth, windowHeight;
    4042      const Uint8* keyState;
  • makefile

    r4a777d2 rcb6fabb  
    3030        $(CC) $^ $(DEP) $(CXX_FLAGS) -o $@ -DGLEW_STATIC
    3131
    32 ifeq ($(OS),Darwin)
    33         VULKAN_SDK_PATH = /Users/dportnoy15/Development/vulkan-sdk-macos-1.1.108.0/macOS
    34 endif
    35 ifeq ($(OS),Linux)
    36         VULKAN_SDK_PATH = /home/dportnoy/Desktop/VulkanSDK/1.1.106.0/x86_64
    37 endif
    38 
    39 LIB_PATHS =  -I$(VULKAN_SDK_PATH)/include
    40 ifeq ($(OS),Darwin)
    41         LIB_PATHS := -Wl,-rpath,$(VULKAN_SDK_PATH)/lib $(LIB_PATHS)
    42 endif
    43 ifeq ($(OS),Linux)
    44         LIB_PATHS =
    45 endif
    46 
    4732LIBS = `pkg-config --static --libs sdl2 sdl2_image sdl2_ttf`
    4833ifeq ($(OS),Darwin)
    49         LIBS := $(VULKAN_SDK_PATH)/lib/libvulkan.dylib $(LIBS)
     34        LIBS := -lvulkan $(LIBS)
    5035endif
    5136ifeq ($(OS),Linux)
  • vulkan-game.cpp

    r4a777d2 rcb6fabb  
    853853      ImGui::NewFrame();
    854854
    855       (this->*currentRenderScreenFn)(gui->getWindowWidth(), gui->getWindowHeight());
     855      int w, h;
     856      SDL_GetWindowSize(((GameGui_SDL*)gui)->window, &w, &h);
     857
     858      // Probably a retina display
     859      // TODO: Find a better fix for this. Maybe I should use SDL_Vulkan_GetWindowSize here instead
     860      // of SDL_Vulkan_GetDrawableSize
     861      if (w < gui->getWindowWidth() && h < gui->getWindowHeight()) {
     862         (this->*currentRenderScreenFn)(w, h);
     863      } else {
     864         (this->*currentRenderScreenFn)(gui->getWindowWidth(), gui->getWindowHeight());
     865      }
    856866
    857867      ImGui::Render();
Note: See TracChangeset for help on using the changeset viewer.