GithubHelp home page GithubHelp logo

ebraminio / antons_opengl_tutorials_book Goto Github PK

View Code? Open in Web Editor NEW

This project forked from capnramses/antons_opengl_tutorials_book

0.0 1.0 0.0 42.83 MB

Anton's OpenGL 4 Tutorials book - Demo Code

Home Page: http://antongerdelan.net/opengl/

License: Other

C++ 11.54% C 87.71% GLSL 0.66% Meson 0.09%

antons_opengl_tutorials_book's Introduction

Meson port of Anton's OpenGL 4 Tutorials book demo code

This series of demos accompanies the e-book "Anton's OpenGL 4 Tutorials": antongerdelan.net/opengl

Meson

Building using Meson can be more portable and reliable in different platforms, and as it's binary free it means a smaller git repository to clone,

git clone https://github.com/ebraminio/antons_opengl_tutorials_book --depth=1

Meson can be installed either from pip or from the system package manager

pip3 install meson
# or in Windows
winget install meson

See also https://mesonbuild.com/Getting-meson.html

Test mechanism of Meson is (mis)used for running the code,

meson setup build
meson compile -C build
meson test -C build

Info

See "LICENCE.txt" for licence information.

Each chapter with major demonstration code has a corresponding demo here. There is also an example of code for Hello Triangle for OpenGL 2.1 for reference.

Each demo has easy-to-read Makefiles for Linux, MacOS, and Windows. You may need to download newer versions of the libraries in the common/ folder.

This code is some years old now and builds may fall out of date. I try to maintain this so that it functions but be aware that Makefiles and build details may differ slightly from book text for this reason.

Compiling

The libraries depended on reside in the common/ folder

  • common/include - Header files.
  • common/linux_x86_64 - 64-bit GNU/Linux libraries.
  • common/osx_64 - 64-bit Apple macOS libraries.
  • common/win32 - 32-bit Windows GCC (MinGW) libraries.
  • common/win64_gcc - 64-bit Windows GCC (MinGW-w64) libraries.

Linux

  • Install a C and C++ compiler - usually by installing a "build-essential" bundle package via the package manager on your distribution. E.g. for Ubuntu:
sudo apt install build-essential
  • Install the GLFW3, FreeType, and zlib development libraries:
sudo apt install libglfw3-dev
sudo apt install libfreetype6-dev
sudo apt install zlib1g-dev
  • Open a terminal and cd to the demo of choice, then
make -f Makefile.linux64

Apple macOS

  • Install Clang or GNU compiler and tools - usually by installing Apple XCode through the App Store. It's free.
  • Open a terminal and cd to the demo of choice:
make -f Makefile.osx

Windows with GCC

  • Install the GNU Compiler Collection - usually by installing MinGW (32-bit or the 64-bit alternative). I suggest the minimal MinGW GCC distro at https://nuwen.net/mingw.html.
  • Open a console and cd to the demo of choice.
  • make -f Makefile.win32 (MinGW may have renamed make.exe to mingw-make32.exe or similar).
  • Copy the .dll files from the main folder to the demo folder
  • Or make -f Makefile.win64 for the 64-bit build.

If you have trouble linking supporting libraries you may need to recompile GLFW, GLEW, AssImp, and Freetype. It's a good idea to do this anyway to stay up to date.

Windows with Visual Studio

The original Visual Studio solution has gone out of date now, so I removed it. I have instead recorded a 2020 video stream tutorial where I show how to get Visual Studio set up and start programming OpenGL, including downloading and setting up libraries.

Tutorial: Intro to 3D Graphics Programming with OpenGL 4 (with Anton). Stream Recording.

This includes a very verbose set-up of Visual Studio 2019 with helper libraries.

Caveats and Errata

  • Since publication the most reliable version of newer OpenGL that will work everywhere, including macOS, is 4.1 Core. I suggest hinting to use this version first.
  • Code is directly copy-pasted from book sections. This means that there will be redundant OpenGL calls to bind things etc., but I think it's easier to follow along like this.
  • Code explained in prior examples is moved to a file called gl_utils.cpp to avoid cluttering main.cpp. This means that gl_utils.cpp is not necessarily the same in each demo, but is built up gradually.
  • Out of date build files have been removed; 32-bit Linux and older Visual Studio files.
  • Sometimes people ask for C examples. OpenGL is a C API, and I would have used C if writing the text later. Readers wishing to use a C compiler should do so - only very minor code convention changes are required.

Credits

Special thanks to all the readers over the years that have submitted additions, bug reports, fixes, and feedback. If you have submitted a correction and don't mind having your name/@ printed here please let me know (or if you'd like to change these details).

Contributors

antons_opengl_tutorials_book's People

Contributors

capnramses avatar workshoft avatar ebraminio avatar postfixnotation avatar 0xbama avatar define-private-public avatar kevinmoran avatar pavroza avatar sarangbaheti avatar

Watchers

 avatar

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.