Giter VIP home page Giter VIP logo

ppgso's Introduction

PPGSO OpenGL Examples

This repository contains simple OpenGL 3.3 examples for educational purposes.

All examples are written in C++11 and use Makefiles AND CMake build system. Additionally the following dependencies are required:

On Linux install the following dependencies using your package manager, for example on Ubuntu do:

sudo apt-get install libglew-dev libglfw3-dev libglm-dev

On OSX install Homebrew package manager and install

brew tap homebrew/versions
brew install glm glfw3 glew

Additionally you can also install CMake and use it to generate project files for your IDE of choice.

Building using make

Recommended for OSX and Linux is to simply use make. For Windows see next section.

cd ppgso-master
make
./gl_gradient

Building and working on Windows

Windows is a special case as always, however it is a lot easier if you avoid Visual Studio entirely. The recommended software is as follows:

  • Download and install TDM64, this is the latest GCC compiler for Windows in a nice installer.
  • Download CLion IDE, the trial is free for 30days and you can register for a FREE COPY using university mail.
  • Run CLion and select TDM64 as the toolchain (default is C:/TDM64..)
  • Setup the rest of the settings as you see fit.
  • Open this directory as an existing project, the examples should now build.
  • For some examples you need to set working directory to the project folder as well.

A good alternative IDE for Windows is QTCreator that should work out of the box with TDM64 and CMake. For other IDEs see below.

Common pitfalls

  • NEVER store projects in paths and directories that contain spaces or non-ascii characters.
  • If you are unfortunate enough to have a username with non-ascii characters builds will fail unless you edit CLion configuration manually.
# Edit idea.properties file in CLion install directory and add
idea.system.path=C:/clion/system
# Make sure the directory exists
  • Ubuntu 14.04 based distributions do not have GLFW3!

  • My linux does not have OpenGL. Missing -lGL

    • Try to install mesa-common-dev, libgl1-mesa-dev and libglu1-mesa-dev

Generic instructions using CMake, should work with Visual Studio

Using CMake from command-line you can generate the project files as shown below. The placeholder [YOUR_GENERATOR] should be replaced with the generator appropriate for your IDE/environment. Usually removing the option entirely will generate the default for the given platform. To find out all available generators just run cmake --help

cd ppgso
mkdir _build && cd _build
cmake .. -G[YOUR_GENERATOR] -DCMAKE_INSTALL_PREFIX=../_install
cmake --build . --target install

When building on Windows CMake might not be able to automatically find all the needed dependencies and will require additional pointers. This is done by setting CMake variables such as GLEW_INCLUDE_DIRS which should point to the headers of the GLEW library that you want to use. Same principle applies for other dependencies. You can alternatively use CMake GUI and point it to the work directory, it will allow you to edit the variables more comfortably.

cd ppgso/_build
cmake .. -DGLFW_INCLUDE_DIRS="C:\libs\glfw3\include" -DGLFW_LIBRARIES="C:\libs\glfw3\glfw3.dll" -DGLEW_INCLUDE_DIRS=...
cmake --build . --target install

After installation the files should be installed into a new _install subdirectory. You can then run the examples as follows:

cd ppgso/_install
./gl_gradient

ppgso's People

Contributors

drahosp avatar nemcek avatar mpk 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.