Changes in / [756162f:b8072d3] in opengl-game


Ignore:
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • compile.sh

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

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

    r756162f rb8072d3  
    3535#endif
    3636
     37   private:
    3738      SDL_Window* window;
    38 
    39    private:
    40       // SDL_Window* window;
    4139      int windowWidth, windowHeight;
    4240      const Uint8* keyState;
  • makefile

    r756162f rb8072d3  
    3030        $(CC) $^ $(DEP) $(CXX_FLAGS) -o $@ -DGLEW_STATIC
    3131
     32ifeq ($(OS),Darwin)
     33        VULKAN_SDK_PATH = /Users/dportnoy15/Development/vulkan-sdk-macos-1.1.108.0/macOS
     34endif
     35ifeq ($(OS),Linux)
     36        VULKAN_SDK_PATH = /home/dportnoy/Desktop/VulkanSDK/1.1.106.0/x86_64
     37endif
     38
     39LIB_PATHS =  -I$(VULKAN_SDK_PATH)/include
     40ifeq ($(OS),Darwin)
     41        LIB_PATHS := -Wl,-rpath,$(VULKAN_SDK_PATH)/lib $(LIB_PATHS)
     42endif
     43ifeq ($(OS),Linux)
     44        LIB_PATHS =
     45endif
     46
    3247LIBS = `pkg-config --static --libs sdl2 sdl2_image sdl2_ttf`
    3348ifeq ($(OS),Darwin)
    34         LIBS := -lvulkan $(LIBS)
     49        LIBS := $(VULKAN_SDK_PATH)/lib/libvulkan.dylib $(LIBS)
    3550endif
    3651ifeq ($(OS),Linux)
     
    7489.PHONY: shaders
    7590shaders:
    76         ./compile.sh
     91        cd shaders && ../compile.sh && cd ..
    7792
    7893clean:
  • vulkan-game.cpp

    r756162f rb8072d3  
    853853      ImGui::NewFrame();
    854854
    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       }
     855      (this->*currentRenderScreenFn)(gui->getWindowWidth(), gui->getWindowHeight());
    866856
    867857      ImGui::Render();
Note: See TracChangeset for help on using the changeset viewer.