Giter VIP home page Giter VIP logo

hrazs2016'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 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

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

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, all the examples should now build.
  • For some examples you need to set working directory to the _install folder that can be generated by building the run_install target.

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

Running the examples

When using CLion you should first build the run_install target. This will generate a installation with all resources present in a {project_root}/_install folder. After that set the working direcotry to this folder for each target manually.

Common pitfalls

  • NEVER store projects in paths and directories that contain spaces or non-ascii characters.
  • If you are unfortunate enough to have a Windows 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

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]
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"
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

Credits

Rudolf Getel for free ship model.

Relevant Documentation

hrazs2016's People

Contributors

secowww avatar

Watchers

James Cloos avatar  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.