Giter Site home page Giter Site logo

bennyqbd / cgfx5 Goto Github PK

View Code? Open in Web Editor NEW
78.0 16.0 17.0 7.86 MB

Base code for thebennybox's 3D Game Programming Tutorial series

License: MIT License

CMake 0.60% Makefile 0.03% Shell 0.11% Batchfile 0.03% C 74.11% C++ 24.88% Objective-C 0.19% GLSL 0.04%

cgfx5's Introduction

CGFX5

Base code for new 3D stuff

Build Dependencies

NOTES for Dependencies

On Unix/Linux/Mac you can likely install CMAKE, GLEW, SDL2 and ASSIMP with your package manager

# On ubuntu just run
sudo apt install cmake libglew-dev libsdl2-dev libassimp-dev

# On Arch Linux & variants just run
sudo pacman -S cmake glew sdl2 assimp

# On Mac with HomeBrew just run
brew install cmake glew sdl2 assimp

Simple Build Instructions

Mac OSX/Linux/Unix

  • Open a Terminal and run:
# install dependencies

./Unix-Build.sh [Build Target, Debug or Release (Optional)] [Any arguments for CMake (Optional)]

#For instance, you can use the CMake argument -G "Xcode" to generate an Xcode project during build,
#or you can use -G "CodeBlocks - Unix Makefiles" to generate a CodeBlocks Project.
#See http://www.cmake.org/ for more details about CMake arguments
  • If this fails for any reason, try using the Manual Build Instructions below.

Windows

  • Make sure CMake is both installed and added to the system PATH.
  • Run "Windows-GenVisualStudioProject.bat" If this fails for any reason, try using the Manual Build Instructions below.
  • Go to the build folder, and open CGFX5.sln with Visual Studio 2012 or newer (For older versions of Visual Studio, use manual build instructions)
  • Right click on the CGFX5 project, and select "Set as start up project"
  • Build and Run

Manual Build Instructions

Linux/Unix

  • Open a Terminal and run:
# install dependencies
cd build
cmake ../
make

Mac OSX

  • Open a Terminal and run:
# install dependencies
cd build
cmake ../
make

Windows/MinGW

  • Make sure CMake is both installed and added to the system PATH.
  • Open a Terminal and run:
# install dependencies
# Install GLEW in %PROGRAMFILES%/GLEW or SET %GLEW_ROOT_DIR% to where GLEW is on your machine (Example: D:\PATH_TO_GLEW)
# Install SDL2 in %PROGRAMFILES%/SDL2 or SET %SDL2_ROOT_DIR% to where SDL2 is on your machine (Example: D:\PATH_TO_SDL2)
# Install ASSIMP in %PROGRAMFILES%/ASSIMP or SET %ASSIMP_ROOT_DIR% to where ASSIMP is on your machine (Example: D:\PATH_TO_ASSIMP)
cd build
# REPLACE "Visual Studio 12" with your preferred build toolchain (Maybe you want "Codeblocks - MinGW Makefiles")
# BTW VS 10 is VS 2010, VS 11 is VS 2012 and VS 12 is VS 2013, BLAME MicroSoft for the naming! LOL! 
cmake -G "Visual Studio 12" ../
# open the generated SLN file (or cbp file if using CodeBlocks) and build!
  • Make sure in the SDL2 include directory, the header files are properly nested under an SDL2 sub directory. The directory structure should look something like : C:\Program Files\SDL2\include\SDL2\.
  • Copy the DLLs in /lib/_bin/ to /build/Debug/ and /build/Release/
  • In Visual Studio, set the Startup project to CGFX5
  • Move the res folder into the build folder
  • Run

Additional Credits

  • @mxaddict for setting up the awesome CMake build system
  • Everyone who's created or contributed to issues and pull requests, which make the project better!

cgfx5's People

Contributors

bennyqbd avatar francesco149 avatar herbstein avatar jorolf avatar mattbazooka avatar ohadrau avatar protheory8 avatar stringflow avatar thebennybox avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cgfx5's Issues

Visual Studio 2017 crashes when building the project.

I haven't done much testing but whenever I build the CGFX5 project it builds until about 1/3 and then crashes.
Can somebody test this on their version as well? I would like to know if this is something "wide-spread" or if this is due to some plugins I have installed.

MSVC Warnings

Turning /Wall on MSVC on causes it to produce ~14000 warnings. I suggest turning it off or change the warning level (4 seems to be ok) for the MSVC generator.

Compiler error building with gcc 4.8.5

CGFX5/src/platform/generic/cmwc4096.c:14:2: error: ‘for’ loop initial declarations are only allowed in C99 mode
  for (int i = 0; i < CMWC_CYCLE; i++)
  ^
CGFX5/src/platform/generic/cmwc4096.c:14:2: note: use option -std=c99 or -std=gnu99 to compile your code

Should be an easy fix, but not sure if you want to change the for loop or require c99.

CLion Assimp compile error

Compiling the base code in CLion results in undefined reference errors to Assimp,
modelLoader.cpp:11: undefined reference to Assimp::Importer::Importer()' modelLoader.cpp:16: undefined reference to Assimp::Importer::ReadFile(char const*, unsigned int)'
modelLoader.cpp:11: undefined reference to Assimp::Importer::~Importer()' modelLoader.cpp:11: undefined reference to Assimp::Importer::~Importer()'

CMake logs show all 3 libraries found
P.S., this is my first issue opened on GitHub so let me know if I did anything incorrect.

MacOS Rendering Bug

That's the result:
drawing
Which is probably not that what it should draw. (Note gl is pretty much dead on OSX/iOS)
It's the same output for debug and release build.

Used Xcode to build via CMake:
./Unix-Build.sh Release -G "Xcode"

Don't assume MSVC version

Currently, inside Windows-GenVisualStudioProject.bat, the command to invoke CMake is assuming that user has MSVC 11 installed, which may not be true. Simply reduce that command to:

cmake ../

allows CMake to automatically pickup the compiler that is present on the system.

Episode 12: makeEntity() declaration and definition error

If we call any makeEntity() wrapper function in the end we call

EntityHandle makeEntity(BaseECSComponent** components, const uint32* componentIDs, size_t numComponents);

that is declared in ecs.hpp and defined in ecs.cpp.

But we also have

template<class A, class B, class C>
EntityHandle makeEntity(A& c1, B& c2, C& c3)

defined in this header file. At least for me the compiler uses this definition for the prior declaration. Of course I get compile errors when I call the wrapper for one component since not the 1st function is called but the wrapper function for 3 components.

Has anyone the same issue? A renaming will solve it. It just feels strange that you didn't get the compile error in the video.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.