This package is intended to be a fully fledged Julia interface to the OpenGL implementation on your machine. OpenGL 1.0, 2.1, 3.2, 3.3, and 4.2/4.3 and GLU functionality is available. Also, ATI and Nvidia specific functions are available, as well as stereo display functions (see "Specialized OpenGL code" below).
I wish I could provide some advice to Windows or Mac OS users, but I barely use those systems anymore.
You will need to specify which version of OpenGL you wish to use by setting the "OpenGLver" global variable to the correct string, prior to loading the package.
#Use OpenGL 1.0 using OpenGL @OpenGL.version "1.0" @OpenGL.load #Use OpenGL 2.1 using OpenGL @OpenGL.version "2.1" @OpenGL.load #Use OpenGL 3.2 using OpenGL @OpenGL.version "3.2" @OpenGL.load #Use OpenGL 3.3 using OpenGL @OpenGL.version "3.3" @OpenGL.load #Use OpenGL 4.2 using OpenGL @OpenGL.version "4.2" @OpenGL.load #Use OpenGL 4.3 using OpenGL @OpenGL.version "4.3" @OpenGL.load
NOTE: It is not possible to load multiple versions of OpenGL into the same instance of Julia. Each successive call to load a given version will redefine the current OpenGL module, effectively replacing that version with whichever new version you have specified. This should not produce any problems and should (hopefully) work as expected.
(You can also load an OpenGL version by requiring the file directly, e.g. require("OpenGL/src/gl33/gl33"))
If you wish to load packages for ATI or Nvidia cards, require the files directly.
#ATI require("OpenGL/src/ati/ati") using ATI #Nvidia require("OpenGL/src/nv/nv") using NVIDIA #wgl - stero functions, etc. require("OpenGL/src/wgl/wgl") using WGL #GLext require("OpenGL/src/ext/ext") using GLEXT #GLX require("OpenGL/src/glx/glx") using GLX #AMD require("OpenGL/src/amd/amd") using AMD #ARB require("OpenGL/src/arb/arb") using ARB #GLU require("OpenGL/src/glu/glu") using GLU
There are some convienence functions for OpenGL 1.0/2.1, written by Jasper, that take advantage of Julia's multiple dispatch. For example, glVertex takes Integer/Float scalars/vectors and calls the appopriate OpenGL function. glRotate, glTranslate, and glColor act similarly.
See the Examples/NeHe directory in the GLUT and SDL packages for OpenGL 1.x code. Controls are listed in the opening comments of each example. Press 'q' in any of the NeHe examples to quit.
Mouse and joystick versions of tutorial 7 can be found in the Examples/NeHe directory. The joystick version is currently untested.
(At the moment, NeHe tutorial 17 will run, but produces a glicthy output. I've yet to figure that out. It may be a while before I return to it, since fonts in 3D applications aren't terribly interesting to me.)
NOTE: Examples with images will not work, unless you have ImageMagick installed on your system, since imread depends on it.
All of the original, foundational work was done by Jasper den Ouden. He produced the original Julia-OpenGL files and wrote the necessary code for integrating them into the Julia environment. Without his FFI, C header parser, original examples, and responses to my questions, I would never have been able to put this into a Julia package. All credit goes to him.
Thanks to jayschwa for suggesting gogl as a source of inspiration. They've done an excellent job of using the correct OpenGL specs (thanks to Jason McKesson) and of translating them into clean, parseable golang code. The scripts used to translate the gogl code to Julia-OpenGL code can be found at gogl_to_jlgl.
Thanks to NeHe Productions for making their tutorials, which served as a wonderful test-bed for this interface.
We'd also like to thank the Khronos Group for making the OpenGL spec and hardware/software companies (open- and closed-source) for adopting it. It has given countless amounts of people the freedom to make beautiful graphics and visualize whatever they desire.
Thanks to the Julia team for making Julia, a programming language that many have been longing for, whether they knew about it or not. The "Octave-for-C-programmers," as one could think of it, is an incredibly fast and powerful programming language that is a welcome breath of fresh air in the technical and numerical programming communities.
Have fun! --rennis250 & o-jasper
about 1 month ago