PDA

View Full Version : setting up OpenGL via terminal on MacOSx 10.5



cutting_crew
12-12-2008, 01:27 PM
hey all i just got a new macbook pro, 10.5 and would like to port of my linux c++ opengl applications over to the mac. just to make things simple port just an opengl application that just opens a window.

do the glut libraries already come on the system or do i have to get them somehow from somewhere? i found the normal glu and gl.h files in /usr/include. what do i need to change or include in a makefile?

any readings on this anywhere? i appreciate it in advance....

cutting_crew
12-12-2008, 03:27 PM
well i got it to work. the library for glut that you include comes from the framework. here is a copy of my Makefile.

i hope that this will be useful for someone.

INC = -I./usr/include/ -I./usr/X11/include/
LIB = -L/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/ -framework OpenGL -framework GLUT
CPP = g++
CPP_OPTS = -g -Wall

opengltest: main.o
@echo '>> Linking $@'
$(CPP) -o opengltest $^ $(LIB)
@echo

main.o: main.cpp
@echo '++ Building $@'
$(CPP) $(CPP_OPTS) -c main.cpp $(INC)
@echo

clean:
@echo '-- Removing temporary files'
rm -f *. opengltest
@echo

arekkusu
12-12-2008, 03:57 PM
From the previous thread (http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Board=5&Number=208771&Searchpage=1&Main=41608&Words=framework&topic=0&Search=true#Post208771):

Forget everything you know about X11.

gcc main.c -framework OpenGL -framework GLUT

and change
#include <GL/glut.h>
#include <GL/gl.h>
to
#include <GLUT/glut.h>
#include <OpenGL/gl.h>

cvision
12-12-2008, 04:29 PM
In order to keep your code the same I think that you can make a sub directory in /System/Library/Frameworks/OpenGL.framework/Headers/GL then make symlinks of the header files to that.

arekkusu
12-12-2008, 05:39 PM
You shouldn't modify /System-- treat it as read-only.

cutting_crew
12-13-2008, 09:41 AM
In order to keep your code the same I think that you can make a sub directory in /System/Library/Frameworks/OpenGL.framework/Headers/GL then make symlinks of the header files to that.

yes it is weird that although i have gl.h and glu.h in /usr/X11/include/GL, in my makefile i have -I./usr/X11/include/.

then in my main program i have #include <GL/gl.h> it says that the folder does not exist. so i am wondering what good it does to even have the include references in the makefile?