Jim's
Tutorials

Spring 2018
course
site

opengl & games

Feb 6 - Jim says

So I tried following https://learnopengl.com/ . The "getting started" section wants you to GLFW - a wrapper library around OpenGL - and to compile it from Microsoft's VisualStudio IDE.

The GLFW site says that it will work with VisualStudio, XCode on Macs, and just from the command line ... though their documentation on how to do so is less than ideal.

I was able to get it to compile and to run their examples (graphics windows with stuff bouncing around) and tests (user mouse input in a window). I did it all from the command line, with cmake and the GLFW sources. I'm pretty sure that this approach would work the same way on a linux box ... maybe windows too.

My steps on my Mac were:

  1. install Xcode (pretty much any Mac development needs this first), and test for clang compiler:
$ which cpp
/usr/bin/cpp
$ cpp --version
Apple LLVM version 9.0.0 (clang-900.0.39.2)
Target: x86_64-apple-darwin17.4.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

But I didn't actually use the Xcode GUI ... so that may not be needed.

  1. install cmake , which I did with homebrew.
$ brew install cmake   # "brew info cmake" to see details.
$ which cmake
/usr/local/bin/cmake
$ cmake --version
cmake version 3.10.2
  1. download glfw-3.2.1.zip from http://www.glfw.org/ and unpack it to glfw-3.2.1/

Then just

$ cd glfw-3.2.1/
$ cmake .
$ make

And that's it. That compiles clickable apps in glfw-3.2.1/examples/ that draw pretty pictures, and command line executables in glfw-3.2.1/tests/ that demo mouse motion and click handling.

The library locations and all that are specified by CMakeLists.txt files, one in each folder of interest (glf2-3.2.1, examples, tests). To create our own application, the next step would be create for example a myapp/ folder with myapp.c and CMakeLists.txt which pointed towards the headers and so on in glfw-3.2.1/ .

That's as far as I got. Things I would stare at next could be

... and then somewhere in there probably back to https://learnopengl.com/ to actually look at the library calls. Or just find tutorials in GLFW itself.

https://cs.marlboro.college /cours /spring2018 /jims_tutorials /opengl /feb6
last modified Sun December 22 2024 5:48 am