Skip to content

Harry and Mike’s project to learn openGL and share what we have learned.

Notifications You must be signed in to change notification settings

mroam/learnOpenGL

Repository files navigation

learnOpenGL

======== Harry and Mike are trying to learn openGL* by installing it, reading tutorials, running code, and revising code. Here is what we’ve found so far including links to installers, tutorials, versions, references, good, better and best videos of our work, etc...

*(“OpenGL” does 3D graphics: it is a cross-platform multi-language code library API for controlling computer graphics chips to draw pictures of 3d objects. PS: Khronos Group maintains OpenGL and they have announced that "Vulkan(https://en.wikipedia.org/wiki/Vulkan_(API))" is the successor to OpenGL as of 2014. Vulkan isn't officially supported on macos nor ios yet. As of WWDC 2018, Apple says developers should use its Metal, is deprecating OpenGL going forward (it still works in iOS 12, macOS 14) and not supporting Vulkan.)

Potential Projects

  • Lunar lander in 3D, as interactive game. (Could it display in red-blue 3d glasses, or virtual reality goggles?)

  • International Space Station in 3D. There are several NASA 3D models, and heavens-above has interactive online ISS using webGL, showing ISS in true place in orbit (with moving solar panels, and ISS turns red when it is not lit by the sun.) The heavens-above model requires a “modern” browser with webGL (works on retina mac osX 10.11 in safari 9, in chrome 48, and in firefox 42).

  • Skydive simulator, interactive game. (Virtual reality?)

References

Tutorials

To Do

  • Continue playing with HSB(HSL/V) conversion to RGB and add functions to our fragment shader.

  • Refactor the big main in our "learnopengl-for-cmake".

  • Have multiple vectors of vertices. (Will this affect VAO or VBO or what?)

  • Figure out how to have front-most things use alpha to block further backs. Blending.

  • Study quaternions.

  • Read OpenGL on mac

  • Resume working with Glitter starter, now that we know how to use CMake, glad, glfw, and "Vendor" folders to make Xcode projects that compile and run with rotating triangles. (Why is our Glitter getting "Vertex shader compilation status: 1 (ok); Fragment shader compilation status: 1 (ok); DANG!--Linking of Shaders failed. ERROR: Compiled vertex shader was corrupt. ERROR: Compiled fragment shader was corrupt.")

  • Figure out how to use glew on mac OR how to work around glew on mac and use whatever apple alternative there is. Can I use cmake to install glew into an xcode project?? Is there any hope (or need?) of finding tutorials that don’t use Glew, or glm, or FreeGlut, etc.?

Questions

  • Can we make cross-platform standalone apps that include everything they need? (glad, glew, glut, x11/xQuartz, or whatever else so that users don’t have to download things we depend upon?? (Isn’t this about “static linking” and/or/versus “installing”??))

  • For portability, maybe we should look into “WebGL”? (“plugin-free 3D for the web, implemented right in the browser. Major browser vendors Apple (Safari), Google (Chrome), Mozilla (Firefox), and Opera (Opera) are members of the WebGL Working Group.”—http://www.khronos.org/webgl/) (What are limitations of webGL, and its foundation “openGL ES” for mobile devices?)

  • Should we use Eclipse or (mac-only) Xcode? If we use Eclipse, don’t we have to set up separate Eclipse copies for Java and C++? Java? C++? (mac only?) Swift? Python?

  • What physics systems play nice with opengl? Do we want to build our own? (Note: the “learnopengl.com” website’s author answers a question about picking an onscreen object by saying “(see) http://www.opengl-tutorial.org... the open source physics library BulletPhysics (an amazing library) is used for collision detection in the project.”

  • Since openGL just draws pictures (“render”) and does not keep track of where our 3d objects are, how best should we keep track of what objects we’re using and where they are and how they are moving? Perhaps through a physics engine? (see note above.) (“OpenGL is a rendering library. What OpenGL does not do is retain information about an “object.” All OpenGL sees is a ball of triangles and a bag of state with which to render them. It does not remember that you drew a line in one location and a sphere in another.” —http://www.opengl.org/wiki/Getting_Started )

Done

  • (√) Gave different colors to the multiple triangles in our working(!) sample "learnopengl-for-cmake". See video

  • (√) Figured out how to tell xcode to put the files into the build destination: ( -Make sure we're in standard editor and leftmost column ("navigator") is visible. -In navigator, click outermost upper project name ("learn"). -Just above the name, choose folder icon ("Project navigator") for view. -In central main view area, upper left has icon: use it to show a sub sidebar "Project and Targets List" xcdoc://?url=developer.apple.com/library/etc/redirect/xcode/devtools/1157/recipes/xcode_help-project_editor/Articles/CreatingaCopyFilesBuildPhase.html -Now can follow the help file re "Copying Files While Building a Product"… -Choose a target in that tiny left sidebar of main central window (we're currently on 'learn' target) -If there is not a "Copy Files" rule then add one, -can drag files onto the list of who gets copied -Specify Destination "Products Directory")

  • (√) Read in shader(s) from external files (as long as those files are in the (xcode) project directory Build/learn/Debug and it works with unicode 8, unix LF)

  • (√) Draw multiple triangles in our working(!) triangle. (From learnopengl.com, uses CMake to build Xcode project --Here's How)-- with glad and glfw.)

  • (√) Got keyboard working to change rotation direction and close window. Got rotation happening with control over degrees/second.

  • (√) Made our xcode glitter project's main.cpp ALMOST match the glfw demo from http://learnopengl.com

  • (√) Copied “Glitter” tutorial and used cmake to make Glitter have an xcode project which compiled and ran (after a few changes, see its readme). --Here's How)--

  • (√) Work-around for running tutorials on make: we found that cmake can make glad + glfw projects for us in Xcode, --Here's How)-- so we can use [glfw](http://www.glfw.org/ in tutorial from http://learnopengl.com).

  • (√) Figured out a fix for our folders being large because having invisible files. Here's a link to something! Work-around: copy across just the cmake and vendor folders (see readme in learnopengl-for-cmake project), get rid of the hidden .git and .gitignore files, and remake with cmake. Voila-small project!

  • (√) Installed “cmake” on our main machine so that the “Glitter” tutorial can build xcode projects for us. --Here's How)--

  • (√) Installed xquartz 2.7.8 on our main machine. (xquartz latest releases as of nov 2015, “works with el capitan (osX 10.11)” supposedly.)

  • (√) The harrygla xcode project folder is happy with github.