diff -ru OpenCSG-1.3.0/Makefile OpenCSG-1.3.0-mac/Makefile
--- OpenCSG-1.3.0/Makefile	2010-02-06 21:35:10.000000000 +0100
+++ OpenCSG-1.3.0-mac/Makefile	2010-05-09 02:50:55.000000000 +0200
@@ -1,10 +1,130 @@
-SUBDIRS = glew src example
+#############################################################################
+# Makefile for building: opencsg
+# Generated by qmake (2.01a) (Qt 4.6.2) on: Sun May 9 02:45:47 2010
+# Project:  opencsg.pro
+# Template: subdirs
+# Command: /usr/bin/qmake -macx CONFIG+=x86\ x86_64 -o Makefile opencsg.pro
+#############################################################################
 
-all:
-	for X in $(SUBDIRS); do make -C $$X ; done
+first: make_default
+MAKEFILE      = Makefile
+QMAKE         = /usr/bin/qmake
+DEL_FILE      = rm -f
+CHK_DIR_EXISTS= test -d
+MKDIR         = mkdir -p
+COPY          = cp -f
+COPY_FILE     = cp -f
+COPY_DIR      = cp -f -R
+INSTALL_FILE  = $(COPY_FILE)
+INSTALL_PROGRAM = $(COPY_FILE)
+INSTALL_DIR   = $(COPY_DIR)
+DEL_FILE      = rm -f
+SYMLINK       = ln -f -s
+DEL_DIR       = rmdir
+MOVE          = mv -f
+CHK_DIR_EXISTS= test -d
+MKDIR         = mkdir -p
+SUBTARGETS    =  \
+		sub-src
 
-clean:
-	for X in $(SUBDIRS); do make -C $$X clean; done
+src/$(MAKEFILE): 
+	@$(CHK_DIR_EXISTS) src/ || $(MKDIR) src/ 
+	cd src/ && $(QMAKE) /Users/kintel/code/metalab/checkout/OpenSCAD/libraries-tmp/src/OpenCSG-1.3.0-patched/src/src.pro -macx CONFIG+=x86\ x86_64 -o $(MAKEFILE)
+sub-src-qmake_all:  FORCE
+	@$(CHK_DIR_EXISTS) src/ || $(MKDIR) src/ 
+	cd src/ && $(QMAKE) /Users/kintel/code/metalab/checkout/OpenSCAD/libraries-tmp/src/OpenCSG-1.3.0-patched/src/src.pro -macx CONFIG+=x86\ x86_64 -o $(MAKEFILE)
+sub-src: src/$(MAKEFILE) FORCE
+	cd src/ && $(MAKE) -f $(MAKEFILE)
+sub-src-make_default: src/$(MAKEFILE) FORCE
+	cd src/ && $(MAKE) -f $(MAKEFILE) 
+sub-src-make_first: src/$(MAKEFILE) FORCE
+	cd src/ && $(MAKE) -f $(MAKEFILE) first
+sub-src-all: src/$(MAKEFILE) FORCE
+	cd src/ && $(MAKE) -f $(MAKEFILE) all
+sub-src-clean: src/$(MAKEFILE) FORCE
+	cd src/ && $(MAKE) -f $(MAKEFILE) clean
+sub-src-distclean: src/$(MAKEFILE) FORCE
+	cd src/ && $(MAKE) -f $(MAKEFILE) distclean
+sub-src-install_subtargets: src/$(MAKEFILE) FORCE
+	cd src/ && $(MAKE) -f $(MAKEFILE) install
+sub-src-uninstall_subtargets: src/$(MAKEFILE) FORCE
+	cd src/ && $(MAKE) -f $(MAKEFILE) uninstall
+
+Makefile: opencsg.pro  /usr/local/Qt4.6/mkspecs/macx-g++/qmake.conf /usr/local/Qt4.6/mkspecs/common/unix.conf \
+		/usr/local/Qt4.6/mkspecs/common/mac.conf \
+		/usr/local/Qt4.6/mkspecs/common/mac-g++.conf \
+		/usr/local/Qt4.6/mkspecs/qconfig.pri \
+		/usr/local/Qt4.6/mkspecs/features/qt_functions.prf \
+		/usr/local/Qt4.6/mkspecs/features/qt_config.prf \
+		/usr/local/Qt4.6/mkspecs/features/exclusive_builds.prf \
+		/usr/local/Qt4.6/mkspecs/features/default_pre.prf \
+		/usr/local/Qt4.6/mkspecs/features/mac/default_pre.prf \
+		/usr/local/Qt4.6/mkspecs/features/mac/dwarf2.prf \
+		/usr/local/Qt4.6/mkspecs/features/debug.prf \
+		/usr/local/Qt4.6/mkspecs/features/default_post.prf \
+		/usr/local/Qt4.6/mkspecs/features/mac/default_post.prf \
+		/usr/local/Qt4.6/mkspecs/features/mac/objective_c.prf \
+		/usr/local/Qt4.6/mkspecs/features/mac/x86_64.prf \
+		/usr/local/Qt4.6/mkspecs/features/mac/x86.prf \
+		/usr/local/Qt4.6/mkspecs/features/warn_on.prf \
+		/usr/local/Qt4.6/mkspecs/features/qt.prf \
+		/usr/local/Qt4.6/mkspecs/features/unix/thread.prf \
+		/usr/local/Qt4.6/mkspecs/features/moc.prf \
+		/usr/local/Qt4.6/mkspecs/features/mac/rez.prf \
+		/usr/local/Qt4.6/mkspecs/features/mac/sdk.prf \
+		/usr/local/Qt4.6/mkspecs/features/resources.prf \
+		/usr/local/Qt4.6/mkspecs/features/uic.prf \
+		/usr/local/Qt4.6/mkspecs/features/yacc.prf \
+		/usr/local/Qt4.6/mkspecs/features/lex.prf \
+		/usr/local/Qt4.6/mkspecs/features/include_source_dir.prf
+	$(QMAKE) -macx CONFIG+=x86\ x86_64 -o Makefile opencsg.pro
+/usr/local/Qt4.6/mkspecs/common/unix.conf:
+/usr/local/Qt4.6/mkspecs/common/mac.conf:
+/usr/local/Qt4.6/mkspecs/common/mac-g++.conf:
+/usr/local/Qt4.6/mkspecs/qconfig.pri:
+/usr/local/Qt4.6/mkspecs/features/qt_functions.prf:
+/usr/local/Qt4.6/mkspecs/features/qt_config.prf:
+/usr/local/Qt4.6/mkspecs/features/exclusive_builds.prf:
+/usr/local/Qt4.6/mkspecs/features/default_pre.prf:
+/usr/local/Qt4.6/mkspecs/features/mac/default_pre.prf:
+/usr/local/Qt4.6/mkspecs/features/mac/dwarf2.prf:
+/usr/local/Qt4.6/mkspecs/features/debug.prf:
+/usr/local/Qt4.6/mkspecs/features/default_post.prf:
+/usr/local/Qt4.6/mkspecs/features/mac/default_post.prf:
+/usr/local/Qt4.6/mkspecs/features/mac/objective_c.prf:
+/usr/local/Qt4.6/mkspecs/features/mac/x86_64.prf:
+/usr/local/Qt4.6/mkspecs/features/mac/x86.prf:
+/usr/local/Qt4.6/mkspecs/features/warn_on.prf:
+/usr/local/Qt4.6/mkspecs/features/qt.prf:
+/usr/local/Qt4.6/mkspecs/features/unix/thread.prf:
+/usr/local/Qt4.6/mkspecs/features/moc.prf:
+/usr/local/Qt4.6/mkspecs/features/mac/rez.prf:
+/usr/local/Qt4.6/mkspecs/features/mac/sdk.prf:
+/usr/local/Qt4.6/mkspecs/features/resources.prf:
+/usr/local/Qt4.6/mkspecs/features/uic.prf:
+/usr/local/Qt4.6/mkspecs/features/yacc.prf:
+/usr/local/Qt4.6/mkspecs/features/lex.prf:
+/usr/local/Qt4.6/mkspecs/features/include_source_dir.prf:
+qmake: qmake_all FORCE
+	@$(QMAKE) -macx CONFIG+=x86\ x86_64 -o Makefile opencsg.pro
+
+qmake_all: sub-src-qmake_all FORCE
+
+make_default: sub-src-make_default FORCE
+make_first: sub-src-make_first FORCE
+all: sub-src-all FORCE
+clean: sub-src-clean FORCE
+distclean: sub-src-distclean FORCE
+	-$(DEL_FILE) Makefile
+install_subtargets: sub-src-install_subtargets FORCE
+uninstall_subtargets: sub-src-uninstall_subtargets FORCE
+
+mocclean: compiler_moc_header_clean compiler_moc_source_clean
+
+mocables: compiler_moc_header_make_all compiler_moc_source_make_all
+install: install_subtargets  FORCE
+
+uninstall:  uninstall_subtargets FORCE
+
+FORCE:
 
-distclean:
-	for X in $(SUBDIRS); do make -C $$X distclean; done
diff -ru OpenCSG-1.3.0/RenderTexture/RenderTexture.h OpenCSG-1.3.0-mac/RenderTexture/RenderTexture.h
--- OpenCSG-1.3.0/RenderTexture/RenderTexture.h	2010-02-06 21:35:10.000000000 +0100
+++ OpenCSG-1.3.0-mac/RenderTexture/RenderTexture.h	2010-05-09 02:51:07.000000000 +0200
@@ -294,8 +294,8 @@
     bool _BindDepthBuffer( ) const;
 
 protected: // data
-    int          _iWidth;     // width of the pbuffer
-    int          _iHeight;    // height of the pbuffer
+    GLint          _iWidth;     // width of the pbuffer
+    GLint          _iHeight;    // height of the pbuffer
     
     bool         _bIsTexture;
     bool         _bIsDepthTexture;
@@ -342,8 +342,8 @@
     
     // Texture stuff
     GLenum       _iTextureTarget;
-    unsigned int _iTextureID;
-    unsigned int _iDepthTextureID;
+    GLuint _iTextureID;
+    GLuint _iDepthTextureID;
     
     unsigned short* _pPoorDepthTexture; // [Redge]
 
diff -ru OpenCSG-1.3.0/example/Makefile OpenCSG-1.3.0-mac/example/Makefile
--- OpenCSG-1.3.0/example/Makefile	2010-02-06 21:35:10.000000000 +0100
+++ OpenCSG-1.3.0-mac/example/Makefile	2010-05-09 02:51:11.000000000 +0200
@@ -1,106 +1,206 @@
 #############################################################################
-# Makefile for building: opencsgexample
-# Generated by qmake (1.06c) (Qt 3.2.0) on: Thu Apr 22 16:05:34 2004
+# Makefile for building: opencsgexample.app/Contents/MacOS/opencsgexample
+# Generated by qmake (2.01a) (Qt 4.6.2) on: Sun May 9 02:43:57 2010
 # Project:  example.pro
 # Template: app
-# Command: $(QMAKE) -o Makefile example.pro
+# Command: /usr/bin/qmake -macx CONFIG+=x86\ x86_64 -o Makefile example.pro
 #############################################################################
 
 ####### Compiler, tools and options
 
-CC       = gcc
-CXX      = g++
-LEX      = flex
-YACC     = yacc
-CFLAGS   = -pipe -Wall -W -O2
-CXXFLAGS = -pipe -Wall -W -O2
-LEXFLAGS = 
-YACCFLAGS= -d
-INCPATH  = -I. -I../glew/include -I../include -I/usr/X11R6/include -I/usr/X11R6/include
-LINK     = g++
-LFLAGS   = 
-LIBS     = $(SUBLIBS) -L/usr/X11R6/lib -L/usr/X11R6/lib -L../lib -lopencsg -lglut -L../glew/lib -lGLEW -lGLU -lGL -lXmu -lXext -lX11 -lm
-AR       = ar cqs
-RANLIB   = 
-MOC      = $(QTDIR)/bin/moc
-UIC      = $(QTDIR)/bin/uic
-QMAKE    = qmake
-TAR      = tar -cf
-GZIP     = gzip -9f
-COPY     = cp -f
-COPY_FILE= $(COPY)
-COPY_DIR = $(COPY) -r
-DEL_FILE = rm -f
-SYMLINK  = ln -sf
-DEL_DIR  = rmdir
-MOVE     = mv -f
+CC            = gcc
+CXX           = g++
+DEFINES       = -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED
+CFLAGS        = -pipe -O2 -Wall -W -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5 -arch i386 $(DEFINES)
+CXXFLAGS      = -pipe -O2 -Wall -W -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5 -arch i386 $(DEFINES)
+INCPATH       = -I/usr/local/Qt4.6/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtGui.framework/Versions/4/Headers -I/usr/include/QtGui -I/usr/include -I../include -I/opt/local/include -I/System/Library/Frameworks/OpenGL.framework/Versions/A/Headers -I/System/Library/Frameworks/AGL.framework/Headers -I. -F/Library/Frameworks
+LINK          = g++
+LFLAGS        = -headerpad_max_install_names -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5 -arch i386
+LIBS          = $(SUBLIBS) -F/Library/Frameworks -L/Library/Frameworks -L../lib -lopencsg -lGLEW -framework GLUT -L/opt/local/lib -framework OpenGL -framework AGL -framework QtGui -framework QtCore 
+AR            = ar cq
+RANLIB        = ranlib -s
+QMAKE         = /usr/bin/qmake
+TAR           = tar -cf
+COMPRESS      = gzip -9f
+COPY          = cp -f
+SED           = sed
+COPY_FILE     = cp -f
+COPY_DIR      = cp -f -R
+STRIP         = 
+INSTALL_FILE  = $(COPY_FILE)
+INSTALL_DIR   = $(COPY_DIR)
+INSTALL_PROGRAM = $(COPY_FILE)
+DEL_FILE      = rm -f
+SYMLINK       = ln -f -s
+DEL_DIR       = rmdir
+MOVE          = mv -f
 CHK_DIR_EXISTS= test -d
-MKDIR    = mkdir -p
+MKDIR         = mkdir -p
+export MACOSX_DEPLOYMENT_TARGET = 10.4
 
 ####### Output directory
 
-OBJECTS_DIR = ./
+OBJECTS_DIR   = ./
 
 ####### Files
 
-HEADERS = displaylistPrimitive.h
-SOURCES = displaylistPrimitive.cpp \
-		main.cpp
-OBJECTS = displaylistPrimitive.o \
+SOURCES       = displaylistPrimitive.cpp \
+		main.cpp 
+OBJECTS       = displaylistPrimitive.o \
 		main.o
-FORMS = 
-UICDECLS = 
-UICIMPLS = 
-SRCMOC   = 
-OBJMOC = 
-DIST	   = example.pro
-QMAKE_TARGET = opencsgexample
-DESTDIR  = 
-TARGET   = opencsgexample
+DIST          = /usr/local/Qt4.6/mkspecs/common/unix.conf \
+		/usr/local/Qt4.6/mkspecs/common/mac.conf \
+		/usr/local/Qt4.6/mkspecs/common/mac-g++.conf \
+		/usr/local/Qt4.6/mkspecs/qconfig.pri \
+		/usr/local/Qt4.6/mkspecs/features/qt_functions.prf \
+		/usr/local/Qt4.6/mkspecs/features/qt_config.prf \
+		/usr/local/Qt4.6/mkspecs/features/exclusive_builds.prf \
+		/usr/local/Qt4.6/mkspecs/features/default_pre.prf \
+		/usr/local/Qt4.6/mkspecs/features/mac/default_pre.prf \
+		/usr/local/Qt4.6/mkspecs/features/release.prf \
+		/usr/local/Qt4.6/mkspecs/features/default_post.prf \
+		/usr/local/Qt4.6/mkspecs/features/mac/default_post.prf \
+		/usr/local/Qt4.6/mkspecs/features/mac/objective_c.prf \
+		/usr/local/Qt4.6/mkspecs/features/warn_on.prf \
+		/usr/local/Qt4.6/mkspecs/features/unix/opengl.prf \
+		/usr/local/Qt4.6/mkspecs/features/mac/x86_64.prf \
+		/usr/local/Qt4.6/mkspecs/features/mac/x86.prf \
+		/usr/local/Qt4.6/mkspecs/features/qt.prf \
+		/usr/local/Qt4.6/mkspecs/features/unix/thread.prf \
+		/usr/local/Qt4.6/mkspecs/features/moc.prf \
+		/usr/local/Qt4.6/mkspecs/features/mac/rez.prf \
+		/usr/local/Qt4.6/mkspecs/features/mac/sdk.prf \
+		/usr/local/Qt4.6/mkspecs/features/resources.prf \
+		/usr/local/Qt4.6/mkspecs/features/uic.prf \
+		/usr/local/Qt4.6/mkspecs/features/yacc.prf \
+		/usr/local/Qt4.6/mkspecs/features/lex.prf \
+		/usr/local/Qt4.6/mkspecs/features/include_source_dir.prf \
+		example.pro
+QMAKE_TARGET  = opencsgexample
+DESTDIR       = 
+TARGET        = opencsgexample.app/Contents/MacOS/opencsgexample
+
+####### Custom Compiler Variables
+QMAKE_COMP_QMAKE_OBJECTIVE_CFLAGS = -pipe \
+		-O2 \
+		-Wall \
+		-W \
+		-arch \
+		x86_64 \
+		-Xarch_x86_64 \
+		-mmacosx-version-min=10.5 \
+		-arch \
+		i386
+
 
 first: all
 ####### Implicit rules
 
-.SUFFIXES: .c .o .cpp .cc .cxx .C
+.SUFFIXES: .o .c .cpp .cc .cxx .C
 
 .cpp.o:
-	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
 
 .cc.o:
-	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
 
 .cxx.o:
-	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
 
 .C.o:
-	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
 
 .c.o:
-	$(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
+	$(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"
 
 ####### Build rules
 
-all: Makefile $(TARGET)
-
-$(TARGET):  $(UICDECLS) $(OBJECTS) $(OBJMOC)  
-	$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS) $(OBJCOMP)
-
-mocables: $(SRCMOC)
-uicables: $(UICDECLS) $(UICIMPLS)
-
-$(MOC): 
-	( cd $(QTDIR)/src/moc ; $(MAKE) )
+all: Makefile opencsgexample.app/Contents/PkgInfo opencsgexample.app/Contents/Resources/empty.lproj opencsgexample.app/Contents/Info.plist $(TARGET)
 
+$(TARGET):  $(OBJECTS)  
+	@$(CHK_DIR_EXISTS) opencsgexample.app/Contents/MacOS/ || $(MKDIR) opencsgexample.app/Contents/MacOS/ 
+	$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
+
+Makefile: example.pro  /usr/local/Qt4.6/mkspecs/macx-g++/qmake.conf /usr/local/Qt4.6/mkspecs/common/unix.conf \
+		/usr/local/Qt4.6/mkspecs/common/mac.conf \
+		/usr/local/Qt4.6/mkspecs/common/mac-g++.conf \
+		/usr/local/Qt4.6/mkspecs/qconfig.pri \
+		/usr/local/Qt4.6/mkspecs/features/qt_functions.prf \
+		/usr/local/Qt4.6/mkspecs/features/qt_config.prf \
+		/usr/local/Qt4.6/mkspecs/features/exclusive_builds.prf \
+		/usr/local/Qt4.6/mkspecs/features/default_pre.prf \
+		/usr/local/Qt4.6/mkspecs/features/mac/default_pre.prf \
+		/usr/local/Qt4.6/mkspecs/features/release.prf \
+		/usr/local/Qt4.6/mkspecs/features/default_post.prf \
+		/usr/local/Qt4.6/mkspecs/features/mac/default_post.prf \
+		/usr/local/Qt4.6/mkspecs/features/mac/objective_c.prf \
+		/usr/local/Qt4.6/mkspecs/features/warn_on.prf \
+		/usr/local/Qt4.6/mkspecs/features/unix/opengl.prf \
+		/usr/local/Qt4.6/mkspecs/features/mac/x86_64.prf \
+		/usr/local/Qt4.6/mkspecs/features/mac/x86.prf \
+		/usr/local/Qt4.6/mkspecs/features/qt.prf \
+		/usr/local/Qt4.6/mkspecs/features/unix/thread.prf \
+		/usr/local/Qt4.6/mkspecs/features/moc.prf \
+		/usr/local/Qt4.6/mkspecs/features/mac/rez.prf \
+		/usr/local/Qt4.6/mkspecs/features/mac/sdk.prf \
+		/usr/local/Qt4.6/mkspecs/features/resources.prf \
+		/usr/local/Qt4.6/mkspecs/features/uic.prf \
+		/usr/local/Qt4.6/mkspecs/features/yacc.prf \
+		/usr/local/Qt4.6/mkspecs/features/lex.prf \
+		/usr/local/Qt4.6/mkspecs/features/include_source_dir.prf \
+		/Library/Frameworks/QtGui.framework/QtGui.prl \
+		/Library/Frameworks/QtCore.framework/QtCore.prl
+	$(QMAKE) -macx CONFIG+=x86\ x86_64 -o Makefile example.pro
+/usr/local/Qt4.6/mkspecs/common/unix.conf:
+/usr/local/Qt4.6/mkspecs/common/mac.conf:
+/usr/local/Qt4.6/mkspecs/common/mac-g++.conf:
+/usr/local/Qt4.6/mkspecs/qconfig.pri:
+/usr/local/Qt4.6/mkspecs/features/qt_functions.prf:
+/usr/local/Qt4.6/mkspecs/features/qt_config.prf:
+/usr/local/Qt4.6/mkspecs/features/exclusive_builds.prf:
+/usr/local/Qt4.6/mkspecs/features/default_pre.prf:
+/usr/local/Qt4.6/mkspecs/features/mac/default_pre.prf:
+/usr/local/Qt4.6/mkspecs/features/release.prf:
+/usr/local/Qt4.6/mkspecs/features/default_post.prf:
+/usr/local/Qt4.6/mkspecs/features/mac/default_post.prf:
+/usr/local/Qt4.6/mkspecs/features/mac/objective_c.prf:
+/usr/local/Qt4.6/mkspecs/features/warn_on.prf:
+/usr/local/Qt4.6/mkspecs/features/unix/opengl.prf:
+/usr/local/Qt4.6/mkspecs/features/mac/x86_64.prf:
+/usr/local/Qt4.6/mkspecs/features/mac/x86.prf:
+/usr/local/Qt4.6/mkspecs/features/qt.prf:
+/usr/local/Qt4.6/mkspecs/features/unix/thread.prf:
+/usr/local/Qt4.6/mkspecs/features/moc.prf:
+/usr/local/Qt4.6/mkspecs/features/mac/rez.prf:
+/usr/local/Qt4.6/mkspecs/features/mac/sdk.prf:
+/usr/local/Qt4.6/mkspecs/features/resources.prf:
+/usr/local/Qt4.6/mkspecs/features/uic.prf:
+/usr/local/Qt4.6/mkspecs/features/yacc.prf:
+/usr/local/Qt4.6/mkspecs/features/lex.prf:
+/usr/local/Qt4.6/mkspecs/features/include_source_dir.prf:
+/Library/Frameworks/QtGui.framework/QtGui.prl:
+/Library/Frameworks/QtCore.framework/QtCore.prl:
+qmake:  FORCE
+	@$(QMAKE) -macx CONFIG+=x86\ x86_64 -o Makefile example.pro
+
+opencsgexample.app/Contents/PkgInfo: 
+	@$(CHK_DIR_EXISTS) opencsgexample.app/Contents || $(MKDIR) opencsgexample.app/Contents 
+	@$(DEL_FILE) opencsgexample.app/Contents/PkgInfo
+	@echo "APPL????" >opencsgexample.app/Contents/PkgInfo
+opencsgexample.app/Contents/Resources/empty.lproj: 
+	@$(CHK_DIR_EXISTS) opencsgexample.app/Contents/Resources || $(MKDIR) opencsgexample.app/Contents/Resources 
+	@touch opencsgexample.app/Contents/Resources/empty.lproj
+	
+opencsgexample.app/Contents/Info.plist: 
+	@$(CHK_DIR_EXISTS) opencsgexample.app/Contents || $(MKDIR) opencsgexample.app/Contents 
+	@$(DEL_FILE) opencsgexample.app/Contents/Info.plist
+	@sed -e "s,@ICON@,,g" -e "s,@EXECUTABLE@,opencsgexample,g" -e "s,@TYPEINFO@,????,g" /usr/local/Qt4.6/mkspecs/macx-g++/Info.plist.app >opencsgexample.app/Contents/Info.plist
 dist: 
-	@mkdir -p .tmp/opencsgexample && $(COPY_FILE) --parents $(SOURCES) $(HEADERS) $(FORMS) $(DIST) .tmp/opencsgexample/ && ( cd `dirname .tmp/opencsgexample` && $(TAR) opencsgexample.tar opencsgexample && $(GZIP) opencsgexample.tar ) && $(MOVE) `dirname .tmp/opencsgexample`/opencsgexample.tar.gz . && $(DEL_FILE) -r .tmp/opencsgexample
-
-mocclean:
+	@$(CHK_DIR_EXISTS) .tmp/opencsgexample1.0.0 || $(MKDIR) .tmp/opencsgexample1.0.0 
+	$(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/opencsgexample1.0.0/ && $(COPY_FILE) --parents displaylistPrimitive.h .tmp/opencsgexample1.0.0/ && $(COPY_FILE) --parents displaylistPrimitive.cpp main.cpp .tmp/opencsgexample1.0.0/ && (cd `dirname .tmp/opencsgexample1.0.0` && $(TAR) opencsgexample1.0.0.tar opencsgexample1.0.0 && $(COMPRESS) opencsgexample1.0.0.tar) && $(MOVE) `dirname .tmp/opencsgexample1.0.0`/opencsgexample1.0.0.tar.gz . && $(DEL_FILE) -r .tmp/opencsgexample1.0.0
 
-uiclean:
 
-yaccclean:
-lexclean:
-clean:
+clean:compiler_clean 
 	-$(DEL_FILE) $(OBJECTS)
 	-$(DEL_FILE) *~ core *.core
 
@@ -108,20 +208,50 @@
 ####### Sub-libraries
 
 distclean: clean
-	-$(DEL_FILE) $(TARGET) $(TARGET)
+	-$(DEL_FILE) -r opencsgexample.app
+	-$(DEL_FILE) Makefile
 
 
-FORCE:
+mocclean: compiler_moc_header_clean compiler_moc_source_clean
+
+mocables: compiler_moc_header_make_all compiler_moc_source_make_all
+
+compiler_objective_c_make_all:
+compiler_objective_c_clean:
+compiler_moc_header_make_all:
+compiler_moc_header_clean:
+compiler_rcc_make_all:
+compiler_rcc_clean:
+compiler_image_collection_make_all: qmake_image_collection.cpp
+compiler_image_collection_clean:
+	-$(DEL_FILE) qmake_image_collection.cpp
+compiler_moc_source_make_all:
+compiler_moc_source_clean:
+compiler_rez_source_make_all:
+compiler_rez_source_clean:
+compiler_uic_make_all:
+compiler_uic_clean:
+compiler_yacc_decl_make_all:
+compiler_yacc_decl_clean:
+compiler_yacc_impl_make_all:
+compiler_yacc_impl_clean:
+compiler_lex_make_all:
+compiler_lex_clean:
+compiler_clean: 
 
 ####### Compile
 
 displaylistPrimitive.o: displaylistPrimitive.cpp displaylistPrimitive.h
+	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o displaylistPrimitive.o displaylistPrimitive.cpp
 
 main.o: main.cpp displaylistPrimitive.h
+	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o main.cpp
 
 ####### Install
 
-install: all 
+install:   FORCE
 
-uninstall: 
+uninstall:   FORCE
+
+FORCE:
 
diff -ru OpenCSG-1.3.0/example/example.pro OpenCSG-1.3.0-mac/example/example.pro
--- OpenCSG-1.3.0/example/example.pro	2010-02-06 21:35:10.000000000 +0100
+++ OpenCSG-1.3.0-mac/example/example.pro	2010-05-09 02:51:14.000000000 +0200
@@ -2,9 +2,16 @@
 TARGET		= opencsgexample
 
 CONFIG	 	+= opengl warn_on release
-INCLUDEPATH += ../glew/include ../include
-
-LIBS        += -L../lib -lopencsg -lglut -L../glew/lib -lGLEW
+INCLUDEPATH     += ../include
+LIBS            += -L../lib -lopencsg -lGLEW
+macx {
+  INCLUDEPATH   += /opt/local/include
+  LIBS          += -framework GLUT -L/opt/local/lib
+}
+else {
+  INCLUDEPATH   += ../glew/include
+  LIBS          += -lglut -L../glew/lib
+}
 
 HEADERS		= displaylistPrimitive.h
 SOURCES		= displaylistPrimitive.cpp main.cpp
diff -ru OpenCSG-1.3.0/example/main.cpp OpenCSG-1.3.0-mac/example/main.cpp
--- OpenCSG-1.3.0/example/main.cpp	2010-02-06 21:35:10.000000000 +0100
+++ OpenCSG-1.3.0-mac/example/main.cpp	2010-05-09 02:51:20.000000000 +0200
@@ -22,7 +22,11 @@
 //
 
 #include <GL/glew.h>
+#ifdef __APPLE__
+#include <GLUT/glut.h>
+#else
 #include <GL/glut.h>
+#endif
 #include <opencsg.h>
 #include "displaylistPrimitive.h"
 #include <iostream>
diff -ru OpenCSG-1.3.0/opencsg.pro OpenCSG-1.3.0-mac/opencsg.pro
--- OpenCSG-1.3.0/opencsg.pro	2010-02-06 21:35:10.000000000 +0100
+++ OpenCSG-1.3.0-mac/opencsg.pro	2010-05-09 02:51:23.000000000 +0200
@@ -1,2 +1,2 @@
 TEMPLATE = subdirs
-SUBDIRS  = src example
+SUBDIRS  = src
diff -ru OpenCSG-1.3.0/src/Makefile OpenCSG-1.3.0-mac/src/Makefile
--- OpenCSG-1.3.0/src/Makefile	2010-02-06 21:35:10.000000000 +0100
+++ OpenCSG-1.3.0-mac/src/Makefile	2010-05-09 02:51:27.000000000 +0200
@@ -1,65 +1,50 @@
 #############################################################################
-# Makefile for building: libopencsg.so.1.3.0
-# Generated by qmake (1.07a) (Qt 3.3.8b) on: Fri Jan 29 22:15:11 2010
+# Makefile for building: libopencsg.1.3.0.dylib
+# Generated by qmake (2.01a) (Qt 4.6.2) on: Sun May 9 02:45:47 2010
 # Project:  src.pro
 # Template: lib
-# Command: $(QMAKE) -o Makefile src.pro
+# Command: /usr/bin/qmake -macx CONFIG+=x86\ x86_64 -o Makefile src.pro
 #############################################################################
 
 ####### Compiler, tools and options
 
-CC       = gcc
-CXX      = g++
-LEX      = flex
-YACC     = yacc
-CFLAGS   = -pipe -Wall -W -O2 -fPIC 
-CXXFLAGS = -pipe -Wall -W -O2 -fPIC
-LEXFLAGS = 
-YACCFLAGS= -d
-INCPATH  = -I. -I../include -I../glew/include -I.. -I/usr/X11R6/include
-LINK     = g++
-LFLAGS   =  -shared -Wl,-soname,libopencsg.so.1 -Wl,-rpath,../lib
-LIBS     = $(SUBLIBS) -L/usr/X11R6/lib -lGLU -lGL -lXmu
-AR       = ar cqs
-RANLIB   = 
-QMAKE    = qmake
-TAR      = tar -cf
-GZIP     = gzip -9f
-COPY     = cp -f
-COPY_FILE= $(COPY)
-COPY_DIR = $(COPY) -r
-DEL_FILE = rm -f
-SYMLINK  = ln -sf
-DEL_DIR  = rmdir
-MOVE     = mv -f
+CC            = gcc
+CXX           = g++
+DEFINES       = -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED
+CFLAGS        = -pipe -O2 -Wall -W -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5 -arch i386 -fPIC $(DEFINES)
+CXXFLAGS      = -pipe -O2 -Wall -W -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5 -arch i386 -fPIC $(DEFINES)
+INCPATH       = -I/usr/local/Qt4.6/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtGui.framework/Versions/4/Headers -I/usr/include/QtGui -I/usr/include -I../include -I.. -I../../../deploy/include -I/System/Library/Frameworks/OpenGL.framework/Versions/A/Headers -I/System/Library/Frameworks/AGL.framework/Headers -I. -F/Library/Frameworks
+LINK          = g++
+LFLAGS        = -headerpad_max_install_names -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5 -arch i386 -single_module -dynamiclib -compatibility_version	1.3 -current_version	1.3.0 -install_name	/Users/kintel/code/metalab/checkout/OpenSCAD/libraries-tmp/deploy/lib/libopencsg.1.dylib
+LIBS          = $(SUBLIBS) -F/Library/Frameworks -L/Library/Frameworks -L/Users/kintel/code/metalab/checkout/OpenSCAD/libraries-tmp/deploy/lib -lGLEW -framework OpenGL -framework AGL -framework QtGui -framework QtCore 
+AR            = ar cq
+RANLIB        = ranlib -s
+QMAKE         = /usr/bin/qmake
+TAR           = tar -cf
+COMPRESS      = gzip -9f
+COPY          = cp -f
+SED           = sed
+COPY_FILE     = cp -f
+COPY_DIR      = cp -f -R
+STRIP         = 
+INSTALL_FILE  = $(COPY_FILE)
+INSTALL_DIR   = $(COPY_DIR)
+INSTALL_PROGRAM = $(COPY_FILE)
+DEL_FILE      = rm -f
+SYMLINK       = ln -f -s
+DEL_DIR       = rmdir
+MOVE          = mv -f
 CHK_DIR_EXISTS= test -d
-MKDIR    = mkdir -p
+MKDIR         = mkdir -p
+export MACOSX_DEPLOYMENT_TARGET = 10.4
 
 ####### Output directory
 
-OBJECTS_DIR = ./
+OBJECTS_DIR   = ./
 
 ####### Files
 
-HEADERS = ../include/opencsg.h \
-		opencsgConfig.h \
-		area.h \
-		batch.h \
-		context.h \
-		channelManager.h \
-		frameBufferObject.h \
-		frameBufferObjectExt.h \
-		occlusionQuery.h \
-		offscreenBuffer.h \
-		opencsgRender.h \
-		openglHelper.h \
-		pBufferTexture.h \
-		primitiveHelper.h \
-		scissorMemo.h \
-		settings.h \
-		stencilManager.h \
-		../RenderTexture/RenderTexture.h
-SOURCES = area.cpp \
+SOURCES       = area.cpp \
 		batch.cpp \
 		context.cpp \
 		channelManager.cpp \
@@ -69,16 +54,14 @@
 		offscreenBuffer.cpp \
 		opencsgRender.cpp \
 		openglHelper.cpp \
-		pBufferTexture.cpp \
 		primitive.cpp \
 		primitiveHelper.cpp \
 		renderGoldfeather.cpp \
 		renderSCS.cpp \
 		scissorMemo.cpp \
 		settings.cpp \
-		stencilManager.cpp \
-		../RenderTexture/RenderTexture.cpp
-OBJECTS = area.o \
+		stencilManager.cpp 
+OBJECTS       = area.o \
 		batch.o \
 		context.o \
 		channelManager.o \
@@ -88,81 +71,171 @@
 		offscreenBuffer.o \
 		opencsgRender.o \
 		openglHelper.o \
-		pBufferTexture.o \
 		primitive.o \
 		primitiveHelper.o \
 		renderGoldfeather.o \
 		renderSCS.o \
 		scissorMemo.o \
 		settings.o \
-		stencilManager.o \
-		RenderTexture.o
-FORMS = 
-UICDECLS = 
-UICIMPLS = 
-SRCMOC   = 
-OBJMOC = 
-DIST	   = src.pro
-QMAKE_TARGET = opencsg
-DESTDIR  = ../lib/
-TARGET   = libopencsg.so.1.3.0
-TARGETA	= ../lib/libopencsg.a
-TARGETD	= libopencsg.so.1.3.0
-TARGET0	= libopencsg.so
-TARGET1	= libopencsg.so.1
-TARGET2	= libopencsg.so.1.3
+		stencilManager.o
+DIST          = /usr/local/Qt4.6/mkspecs/common/unix.conf \
+		/usr/local/Qt4.6/mkspecs/common/mac.conf \
+		/usr/local/Qt4.6/mkspecs/common/mac-g++.conf \
+		/usr/local/Qt4.6/mkspecs/qconfig.pri \
+		/usr/local/Qt4.6/mkspecs/features/qt_functions.prf \
+		/usr/local/Qt4.6/mkspecs/features/qt_config.prf \
+		/usr/local/Qt4.6/mkspecs/features/exclusive_builds.prf \
+		/usr/local/Qt4.6/mkspecs/features/default_pre.prf \
+		/usr/local/Qt4.6/mkspecs/features/mac/default_pre.prf \
+		/usr/local/Qt4.6/mkspecs/features/release.prf \
+		/usr/local/Qt4.6/mkspecs/features/default_post.prf \
+		/usr/local/Qt4.6/mkspecs/features/mac/default_post.prf \
+		/usr/local/Qt4.6/mkspecs/features/mac/objective_c.prf \
+		/usr/local/Qt4.6/mkspecs/features/warn_on.prf \
+		/usr/local/Qt4.6/mkspecs/features/unix/opengl.prf \
+		/usr/local/Qt4.6/mkspecs/features/mac/x86_64.prf \
+		/usr/local/Qt4.6/mkspecs/features/mac/x86.prf \
+		/usr/local/Qt4.6/mkspecs/features/qt.prf \
+		/usr/local/Qt4.6/mkspecs/features/unix/thread.prf \
+		/usr/local/Qt4.6/mkspecs/features/moc.prf \
+		/usr/local/Qt4.6/mkspecs/features/mac/rez.prf \
+		/usr/local/Qt4.6/mkspecs/features/mac/sdk.prf \
+		/usr/local/Qt4.6/mkspecs/features/resources.prf \
+		/usr/local/Qt4.6/mkspecs/features/uic.prf \
+		/usr/local/Qt4.6/mkspecs/features/yacc.prf \
+		/usr/local/Qt4.6/mkspecs/features/lex.prf \
+		/usr/local/Qt4.6/mkspecs/features/include_source_dir.prf \
+		src.pro
+QMAKE_TARGET  = opencsg
+DESTDIR       = 
+TARGET        = libopencsg.1.3.0.dylib
+TARGETA       = libopencsg.a
+TARGETD       = libopencsg.1.3.0.dylib
+TARGET0       = libopencsg.dylib
+TARGET1       = libopencsg.1.dylib
+TARGET2       = libopencsg.1.3.dylib
+
+####### Custom Compiler Variables
+QMAKE_COMP_QMAKE_OBJECTIVE_CFLAGS = -pipe \
+		-O2 \
+		-Wall \
+		-W \
+		-arch \
+		x86_64 \
+		-Xarch_x86_64 \
+		-mmacosx-version-min=10.5 \
+		-arch \
+		i386
+
 
 first: all
 ####### Implicit rules
 
-.SUFFIXES: .c .o .cpp .cc .cxx .C
+.SUFFIXES: .o .c .cpp .cc .cxx .C
 
 .cpp.o:
-	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
 
 .cc.o:
-	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
 
 .cxx.o:
-	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
 
 .C.o:
-	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
 
 .c.o:
-	$(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
+	$(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"
 
 ####### Build rules
 
-all: Makefile  ../lib/$(TARGET)
+all: Makefile  $(TARGET)
 
-../lib/$(TARGET):  $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) $(OBJCOMP)  
-	test -d ../lib/ || mkdir -p ../lib/
+$(TARGET):  $(OBJECTS) $(SUBLIBS) $(OBJCOMP)  
 	-$(DEL_FILE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)
-	$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS) $(OBJCOMP)
+	$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(LIBS) $(OBJCOMP)
 	-ln -s $(TARGET) $(TARGET0)
 	-ln -s $(TARGET) $(TARGET1)
 	-ln -s $(TARGET) $(TARGET2)
-	-$(DEL_FILE) ../lib/$(TARGET)
-	-$(DEL_FILE) ../lib/$(TARGET0)
-	-$(DEL_FILE) ../lib/$(TARGET1)
-	-$(DEL_FILE) ../lib/$(TARGET2)
-	-$(MOVE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) ../lib/
 
 
 
 staticlib: $(TARGETA)
 
-$(TARGETA):  $(UICDECLS) $(OBJECTS) $(OBJMOC) $(OBJCOMP)
+$(TARGETA):  $(OBJECTS) $(OBJCOMP) 
 	-$(DEL_FILE) $(TARGETA) 
-	$(AR) $(TARGETA) $(OBJECTS) $(OBJMOC)
+	$(AR) $(TARGETA) $(OBJECTS)
+	$(RANLIB) $(TARGETA)
+
+Makefile: src.pro  /usr/local/Qt4.6/mkspecs/macx-g++/qmake.conf /usr/local/Qt4.6/mkspecs/common/unix.conf \
+		/usr/local/Qt4.6/mkspecs/common/mac.conf \
+		/usr/local/Qt4.6/mkspecs/common/mac-g++.conf \
+		/usr/local/Qt4.6/mkspecs/qconfig.pri \
+		/usr/local/Qt4.6/mkspecs/features/qt_functions.prf \
+		/usr/local/Qt4.6/mkspecs/features/qt_config.prf \
+		/usr/local/Qt4.6/mkspecs/features/exclusive_builds.prf \
+		/usr/local/Qt4.6/mkspecs/features/default_pre.prf \
+		/usr/local/Qt4.6/mkspecs/features/mac/default_pre.prf \
+		/usr/local/Qt4.6/mkspecs/features/release.prf \
+		/usr/local/Qt4.6/mkspecs/features/default_post.prf \
+		/usr/local/Qt4.6/mkspecs/features/mac/default_post.prf \
+		/usr/local/Qt4.6/mkspecs/features/mac/objective_c.prf \
+		/usr/local/Qt4.6/mkspecs/features/warn_on.prf \
+		/usr/local/Qt4.6/mkspecs/features/unix/opengl.prf \
+		/usr/local/Qt4.6/mkspecs/features/mac/x86_64.prf \
+		/usr/local/Qt4.6/mkspecs/features/mac/x86.prf \
+		/usr/local/Qt4.6/mkspecs/features/qt.prf \
+		/usr/local/Qt4.6/mkspecs/features/unix/thread.prf \
+		/usr/local/Qt4.6/mkspecs/features/moc.prf \
+		/usr/local/Qt4.6/mkspecs/features/mac/rez.prf \
+		/usr/local/Qt4.6/mkspecs/features/mac/sdk.prf \
+		/usr/local/Qt4.6/mkspecs/features/resources.prf \
+		/usr/local/Qt4.6/mkspecs/features/uic.prf \
+		/usr/local/Qt4.6/mkspecs/features/yacc.prf \
+		/usr/local/Qt4.6/mkspecs/features/lex.prf \
+		/usr/local/Qt4.6/mkspecs/features/include_source_dir.prf \
+		/Library/Frameworks/QtGui.framework/QtGui.prl \
+		/Library/Frameworks/QtCore.framework/QtCore.prl
+	$(QMAKE) -macx CONFIG+=x86\ x86_64 -o Makefile src.pro
+/usr/local/Qt4.6/mkspecs/common/unix.conf:
+/usr/local/Qt4.6/mkspecs/common/mac.conf:
+/usr/local/Qt4.6/mkspecs/common/mac-g++.conf:
+/usr/local/Qt4.6/mkspecs/qconfig.pri:
+/usr/local/Qt4.6/mkspecs/features/qt_functions.prf:
+/usr/local/Qt4.6/mkspecs/features/qt_config.prf:
+/usr/local/Qt4.6/mkspecs/features/exclusive_builds.prf:
+/usr/local/Qt4.6/mkspecs/features/default_pre.prf:
+/usr/local/Qt4.6/mkspecs/features/mac/default_pre.prf:
+/usr/local/Qt4.6/mkspecs/features/release.prf:
+/usr/local/Qt4.6/mkspecs/features/default_post.prf:
+/usr/local/Qt4.6/mkspecs/features/mac/default_post.prf:
+/usr/local/Qt4.6/mkspecs/features/mac/objective_c.prf:
+/usr/local/Qt4.6/mkspecs/features/warn_on.prf:
+/usr/local/Qt4.6/mkspecs/features/unix/opengl.prf:
+/usr/local/Qt4.6/mkspecs/features/mac/x86_64.prf:
+/usr/local/Qt4.6/mkspecs/features/mac/x86.prf:
+/usr/local/Qt4.6/mkspecs/features/qt.prf:
+/usr/local/Qt4.6/mkspecs/features/unix/thread.prf:
+/usr/local/Qt4.6/mkspecs/features/moc.prf:
+/usr/local/Qt4.6/mkspecs/features/mac/rez.prf:
+/usr/local/Qt4.6/mkspecs/features/mac/sdk.prf:
+/usr/local/Qt4.6/mkspecs/features/resources.prf:
+/usr/local/Qt4.6/mkspecs/features/uic.prf:
+/usr/local/Qt4.6/mkspecs/features/yacc.prf:
+/usr/local/Qt4.6/mkspecs/features/lex.prf:
+/usr/local/Qt4.6/mkspecs/features/include_source_dir.prf:
+/Library/Frameworks/QtGui.framework/QtGui.prl:
+/Library/Frameworks/QtCore.framework/QtCore.prl:
+qmake:  FORCE
+	@$(QMAKE) -macx CONFIG+=x86\ x86_64 -o Makefile src.pro
 
 dist: 
-	@mkdir -p .tmp/opencsg && $(COPY_FILE) --parents $(SOURCES) $(HEADERS) $(FORMS) $(DIST) .tmp/opencsg/ && ( cd `dirname .tmp/opencsg` && $(TAR) opencsg.tar opencsg && $(GZIP) opencsg.tar ) && $(MOVE) `dirname .tmp/opencsg`/opencsg.tar.gz . && $(DEL_FILE) -r .tmp/opencsg
+	@$(CHK_DIR_EXISTS) .tmp/opencsg1.3.0 || $(MKDIR) .tmp/opencsg1.3.0 
+	$(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/opencsg1.3.0/ && $(COPY_FILE) --parents ../include/opencsg.h opencsgConfig.h area.h batch.h context.h channelManager.h frameBufferObject.h frameBufferObjectExt.h occlusionQuery.h offscreenBuffer.h opencsgRender.h openglHelper.h primitiveHelper.h scissorMemo.h settings.h stencilManager.h .tmp/opencsg1.3.0/ && $(COPY_FILE) --parents area.cpp batch.cpp context.cpp channelManager.cpp frameBufferObject.cpp frameBufferObjectExt.cpp occlusionQuery.cpp offscreenBuffer.cpp opencsgRender.cpp openglHelper.cpp primitive.cpp primitiveHelper.cpp renderGoldfeather.cpp renderSCS.cpp scissorMemo.cpp settings.cpp stencilManager.cpp .tmp/opencsg1.3.0/ && (cd `dirname .tmp/opencsg1.3.0` && $(TAR) opencsg1.3.0.tar opencsg1.3.0 && $(COMPRESS) opencsg1.3.0.tar) && $(MOVE) `dirname .tmp/opencsg1.3.0`/opencsg1.3.0.tar.gz . && $(DEL_FILE) -r .tmp/opencsg1.3.0
+
 
-yaccclean:
-lexclean:
-clean:
+clean:compiler_clean 
 	-$(DEL_FILE) $(OBJECTS)
 	-$(DEL_FILE) *~ core *.core
 
@@ -170,44 +243,77 @@
 ####### Sub-libraries
 
 distclean: clean
-	-$(DEL_FILE) ../lib/$(TARGET) $(TARGET)
-	-$(DEL_FILE) ../lib/$(TARGET0) ../lib/$(TARGET1) ../lib/$(TARGET2) $(TARGETA)
-
-
-FORCE:
+	-$(DEL_FILE) $(TARGET) 
+	-$(DEL_FILE) $(TARGET0) $(TARGET1) $(TARGET2) $(TARGETA)
+	-$(DEL_FILE) Makefile
+
+
+mocclean: compiler_moc_header_clean compiler_moc_source_clean
+
+mocables: compiler_moc_header_make_all compiler_moc_source_make_all
+
+compiler_objective_c_make_all:
+compiler_objective_c_clean:
+compiler_moc_header_make_all:
+compiler_moc_header_clean:
+compiler_rcc_make_all:
+compiler_rcc_clean:
+compiler_image_collection_make_all: qmake_image_collection.cpp
+compiler_image_collection_clean:
+	-$(DEL_FILE) qmake_image_collection.cpp
+compiler_moc_source_make_all:
+compiler_moc_source_clean:
+compiler_rez_source_make_all:
+compiler_rez_source_clean:
+compiler_uic_make_all:
+compiler_uic_clean:
+compiler_yacc_decl_make_all:
+compiler_yacc_decl_clean:
+compiler_yacc_impl_make_all:
+compiler_yacc_impl_clean:
+compiler_lex_make_all:
+compiler_lex_clean:
+compiler_clean: 
 
 ####### Compile
 
 area.o: area.cpp opencsgConfig.h \
 		area.h \
 		openglHelper.h
+	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o area.o area.cpp
 
 batch.o: batch.cpp opencsgConfig.h \
 		batch.h \
 		primitiveHelper.h \
 		area.h
+	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o batch.o batch.cpp
 
 context.o: context.cpp opencsgConfig.h \
 		context.h \
 		offscreenBuffer.h
+	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o context.o context.cpp
 
 channelManager.o: channelManager.cpp opencsgConfig.h \
 		channelManager.h \
 		offscreenBuffer.h \
 		openglHelper.h \
-		settings.h \
-		area.h
+		area.h \
+		settings.h
+	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o channelManager.o channelManager.cpp
 
 frameBufferObject.o: frameBufferObject.cpp opencsgConfig.h \
 		frameBufferObject.h \
 		offscreenBuffer.h
+	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o frameBufferObject.o frameBufferObject.cpp
 
 frameBufferObjectExt.o: frameBufferObjectExt.cpp opencsgConfig.h \
 		frameBufferObjectExt.h \
 		offscreenBuffer.h
+	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o frameBufferObjectExt.o frameBufferObjectExt.cpp
 
 occlusionQuery.o: occlusionQuery.cpp opencsgConfig.h \
 		occlusionQuery.h
+	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o occlusionQuery.o occlusionQuery.cpp
 
 offscreenBuffer.o: offscreenBuffer.cpp opencsgConfig.h \
 		context.h \
@@ -215,27 +321,28 @@
 		frameBufferObject.h \
 		frameBufferObjectExt.h \
 		pBufferTexture.h
+	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o offscreenBuffer.o offscreenBuffer.cpp
 
 opencsgRender.o: opencsgRender.cpp opencsgConfig.h \
 		opencsgRender.h \
 		primitiveHelper.h \
-		settings.h \
-		area.h
+		area.h \
+		settings.h
+	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o opencsgRender.o opencsgRender.cpp
 
 openglHelper.o: openglHelper.cpp opencsgConfig.h \
 		openglHelper.h \
 		area.h
-
-pBufferTexture.o: pBufferTexture.cpp opencsgConfig.h \
-		pBufferTexture.h \
-		offscreenBuffer.h
+	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o openglHelper.o openglHelper.cpp
 
 primitive.o: primitive.cpp opencsgConfig.h
+	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o primitive.o primitive.cpp
 
 primitiveHelper.o: primitiveHelper.cpp opencsgConfig.h \
 		openglHelper.h \
-		primitiveHelper.h \
-		area.h
+		area.h \
+		primitiveHelper.h
+	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o primitiveHelper.o primitiveHelper.cpp
 
 renderGoldfeather.o: renderGoldfeather.cpp opencsgConfig.h \
 		opencsgRender.h \
@@ -243,10 +350,11 @@
 		channelManager.h \
 		occlusionQuery.h \
 		openglHelper.h \
+		area.h \
 		primitiveHelper.h \
 		scissorMemo.h \
-		stencilManager.h \
-		area.h
+		stencilManager.h
+	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o renderGoldfeather.o renderGoldfeather.cpp
 
 renderSCS.o: renderSCS.cpp opencsgConfig.h \
 		opencsgRender.h \
@@ -254,29 +362,57 @@
 		channelManager.h \
 		occlusionQuery.h \
 		openglHelper.h \
+		area.h \
 		primitiveHelper.h \
-		scissorMemo.h \
-		area.h
+		scissorMemo.h
+	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o renderSCS.o renderSCS.cpp
 
 scissorMemo.o: scissorMemo.cpp opencsgConfig.h \
 		openglHelper.h \
-		scissorMemo.h \
 		area.h \
+		scissorMemo.h \
 		channelManager.h
+	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o scissorMemo.o scissorMemo.cpp
 
 settings.o: settings.cpp opencsgConfig.h
+	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o settings.o settings.cpp
 
 stencilManager.o: stencilManager.cpp opencsgConfig.h \
 		area.h \
 		openglHelper.h \
 		stencilManager.h
-
-RenderTexture.o: ../RenderTexture/RenderTexture.cpp ../RenderTexture/RenderTexture.h
-	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o RenderTexture.o ../RenderTexture/RenderTexture.cpp
+	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o stencilManager.o stencilManager.cpp
 
 ####### Install
 
-install: all 
+install_target: first FORCE
+	@$(CHK_DIR_EXISTS) $(INSTALL_ROOT)/Users/kintel/code/metalab/checkout/OpenSCAD/libraries-tmp/deploy/lib/ || $(MKDIR) $(INSTALL_ROOT)/Users/kintel/code/metalab/checkout/OpenSCAD/libraries-tmp/deploy/lib/ 
+	-$(INSTALL_PROGRAM) "$(TARGET)" "$(INSTALL_ROOT)/Users/kintel/code/metalab/checkout/OpenSCAD/libraries-tmp/deploy/lib/$(TARGET)"
+	-$(SYMLINK) "$(TARGET)" "$(INSTALL_ROOT)/Users/kintel/code/metalab/checkout/OpenSCAD/libraries-tmp/deploy/lib/$(TARGET0)"
+	-$(SYMLINK) "$(TARGET)" "$(INSTALL_ROOT)/Users/kintel/code/metalab/checkout/OpenSCAD/libraries-tmp/deploy/lib/$(TARGET1)"
+	-$(SYMLINK) "$(TARGET)" "$(INSTALL_ROOT)/Users/kintel/code/metalab/checkout/OpenSCAD/libraries-tmp/deploy/lib/$(TARGET2)"
+
+uninstall_target:  FORCE
+	-$(DEL_FILE) "$(INSTALL_ROOT)/Users/kintel/code/metalab/checkout/OpenSCAD/libraries-tmp/deploy/lib/$(TARGET)" 
+	 -$(DEL_FILE) "$(INSTALL_ROOT)/Users/kintel/code/metalab/checkout/OpenSCAD/libraries-tmp/deploy/lib/$(TARGET0)" 
+	 -$(DEL_FILE) "$(INSTALL_ROOT)/Users/kintel/code/metalab/checkout/OpenSCAD/libraries-tmp/deploy/lib/$(TARGET1)" 
+	 -$(DEL_FILE) "$(INSTALL_ROOT)/Users/kintel/code/metalab/checkout/OpenSCAD/libraries-tmp/deploy/lib/$(TARGET2)"
+	-$(DEL_DIR) $(INSTALL_ROOT)/Users/kintel/code/metalab/checkout/OpenSCAD/libraries-tmp/deploy/lib/ 
+
+
+install_headers: first FORCE
+	@$(CHK_DIR_EXISTS) $(INSTALL_ROOT)/Users/kintel/code/metalab/checkout/OpenSCAD/libraries-tmp/deploy/include/ || $(MKDIR) $(INSTALL_ROOT)/Users/kintel/code/metalab/checkout/OpenSCAD/libraries-tmp/deploy/include/ 
+	-$(INSTALL_FILE) /Users/kintel/code/metalab/checkout/OpenSCAD/libraries-tmp/src/OpenCSG-1.3.0-patched/include/opencsg.h $(INSTALL_ROOT)/Users/kintel/code/metalab/checkout/OpenSCAD/libraries-tmp/deploy/include/
+
 
-uninstall: 
+uninstall_headers:  FORCE
+	-$(DEL_FILE) -r $(INSTALL_ROOT)/Users/kintel/code/metalab/checkout/OpenSCAD/libraries-tmp/deploy/include/opencsg.h
+	-$(DEL_DIR) $(INSTALL_ROOT)/Users/kintel/code/metalab/checkout/OpenSCAD/libraries-tmp/deploy/include/ 
+
+
+install:  install_target install_headers  FORCE
+
+uninstall: uninstall_target uninstall_headers   FORCE
+
+FORCE:
 
diff -ru OpenCSG-1.3.0/src/channelManager.cpp OpenCSG-1.3.0-mac/src/channelManager.cpp
--- OpenCSG-1.3.0/src/channelManager.cpp	2010-02-06 21:35:10.000000000 +0100
+++ OpenCSG-1.3.0-mac/src/channelManager.cpp	2010-05-09 02:51:32.000000000 +0200
@@ -23,7 +23,7 @@
 #include <GL/glew.h>
 #ifdef _WIN32
 #include <GL/wglew.h>
-#else
+#elif !defined(__APPLE__)
 #include <GL/glxew.h>
 #endif
 
@@ -170,9 +170,11 @@
 #ifdef WIN32
                 && WGLEW_ARB_pbuffer
                 && WGLEW_ARB_pixel_format
-#else
+#elif !defined(__APPLE__)
                 && GLXEW_SGIX_pbuffer
                 && GLXEW_SGIX_fbconfig
+#else
+                && false
 #endif
             ) {
                 newOffscreenType = OpenCSG::PBuffer;
diff -ru OpenCSG-1.3.0/src/frameBufferObject.h OpenCSG-1.3.0-mac/src/frameBufferObject.h
--- OpenCSG-1.3.0/src/frameBufferObject.h	2010-02-06 21:35:10.000000000 +0100
+++ OpenCSG-1.3.0-mac/src/frameBufferObject.h	2010-05-09 02:51:36.000000000 +0200
@@ -79,11 +79,11 @@
 
             /// Texture stuff
             GLenum       textureTarget;
-            unsigned int textureID;
-            unsigned int depthID;
+            GLuint textureID;
+            GLuint depthID;
 
-            unsigned int framebufferID;
-            int oldFramebufferID;
+            GLuint framebufferID;
+            GLint oldFramebufferID;
 
             bool         initialized;
         };
diff -ru OpenCSG-1.3.0/src/occlusionQuery.cpp OpenCSG-1.3.0-mac/src/occlusionQuery.cpp
--- OpenCSG-1.3.0/src/occlusionQuery.cpp	2010-02-06 21:35:10.000000000 +0100
+++ OpenCSG-1.3.0-mac/src/occlusionQuery.cpp	2010-05-09 02:51:40.000000000 +0200
@@ -57,7 +57,7 @@
         }
 
         unsigned int OcclusionQueryARB::getQueryResult() {
-            unsigned int fragmentCount;
+            GLuint fragmentCount;
             glGetQueryObjectuivARB(mQueryObject, GL_QUERY_RESULT_ARB, &fragmentCount);
             return fragmentCount;
         }
@@ -94,7 +94,7 @@
         }
 
         unsigned int OcclusionQueryNV::getQueryResult() {
-            unsigned int fragmentCount;
+            GLuint fragmentCount;
             glGetOcclusionQueryuivNV(mQueryObject, GL_PIXEL_COUNT_NV, &fragmentCount);
             return fragmentCount;
         }
diff -ru OpenCSG-1.3.0/src/openglHelper.cpp OpenCSG-1.3.0-mac/src/openglHelper.cpp
--- OpenCSG-1.3.0/src/openglHelper.cpp	2010-02-06 21:35:10.000000000 +0100
+++ OpenCSG-1.3.0-mac/src/openglHelper.cpp	2010-05-09 02:51:44.000000000 +0200
@@ -29,13 +29,13 @@
 
         GLfloat projection[16];
         GLfloat modelview[16];
-        int canvasPos[4];
+        GLint canvasPos[4];
 
-        int stencilBits = 0;
+        GLint stencilBits = 0;
         int stencilMax = 0;
         int stencilMask = 0;
 
-        int scissorPos[4];
+        GLint scissorPos[4];
 
         void scissor(const PCArea& area) {
             const int dx = area.maxx - area.minx;
diff -ru OpenCSG-1.3.0/src/openglHelper.h OpenCSG-1.3.0-mac/src/openglHelper.h
--- OpenCSG-1.3.0/src/openglHelper.h	2010-02-06 21:35:10.000000000 +0100
+++ OpenCSG-1.3.0-mac/src/openglHelper.h	2010-05-09 02:51:48.000000000 +0200
@@ -36,17 +36,17 @@
             // copy of the projection matrix during CSG computation
         extern GLfloat modelview[16];
             // copy of the modelview matrix during CSG computation
-        extern int canvasPos[4];
+        extern GLint canvasPos[4];
             // copy of the viewport size during CSG computation
 
-        extern int stencilBits;
+        extern GLint stencilBits;
             // number of stencil bits in the pbuffer
         extern int stencilMax;
             // the number where the stencil value would "wrap around" to zero
         extern int stencilMask;
             // stencilMax - 1
 
-        extern int scissorPos[4];
+        extern GLint scissorPos[4];
             // copy of the scissor settings for CSG computation
 
         void scissor(const PCArea& area);
diff -ru OpenCSG-1.3.0/src/pBufferTexture.h OpenCSG-1.3.0-mac/src/pBufferTexture.h
--- OpenCSG-1.3.0/src/pBufferTexture.h	2010-02-06 21:35:10.000000000 +0100
+++ OpenCSG-1.3.0-mac/src/pBufferTexture.h	2010-05-09 02:51:53.000000000 +0200
@@ -22,7 +22,7 @@
 
 #ifndef __OpenCSG__pbuffer_texture_h__
 #define __OpenCSG__pbuffer_texture_h__
-
+#ifndef __APPLE__
 #include "opencsgConfig.h"
 #include "offscreenBuffer.h"
 
@@ -84,5 +84,27 @@
     } // namespace OpenGL
 
 } // namespace OpenCSG
+#else
+
+namespace OpenCSG {
+  namespace OpenGL {
+    class PBufferTexture : public OffscreenBuffer {
+      virtual bool Initialize(int , int , bool , bool ) {return false;}
+      virtual bool IsInitialized() const {return false;}
+      virtual bool Reset() {return false;}
+      virtual bool Resize(int, int) {return false;}
+      virtual bool BeginCapture() {return false;}
+      virtual bool EndCapture() {return false;}
+      virtual void Bind() const {}
+      virtual void EnableTextureTarget() const {}
+      virtual void DisableTextureTarget() const {}
+      virtual unsigned int GetTextureTarget() const {return 0;}
+      virtual int GetWidth() const {return 0;}
+      virtual int GetHeight() const {return 0;}
+      virtual bool haveSeparateContext() const {return false;}
+    };
+  }
+}
 
+#endif // __APPLE__
 #endif // __OpenCSG__frame_buffer_object_h__
diff -ru OpenCSG-1.3.0/src/src.pro OpenCSG-1.3.0-mac/src/src.pro
--- OpenCSG-1.3.0/src/src.pro	2010-02-06 21:35:10.000000000 +0100
+++ OpenCSG-1.3.0-mac/src/src.pro	2010-05-09 02:51:57.000000000 +0200
@@ -1,10 +1,31 @@
 TEMPLATE	= lib
 TARGET		= opencsg
 VERSION     = 1.3.0
-DESTDIR     = ../lib
 
 CONFIG		+= opengl warn_on release
-INCLUDEPATH += ../include ../glew/include ../
+INCLUDEPATH += ../include ../
+
+# Optionally specify deployment location using the 
+# MACOSX_DEPLOY_DIR env. variable
+DEPLOYDIR = $$(MACOSX_DEPLOY_DIR)
+
+!isEmpty(DEPLOYDIR) {
+  message("Deploy")
+  INSTALLDIR     = $$(MACOSX_DEPLOY_DIR)
+  INCLUDEPATH += $$(MACOSX_DEPLOY_DIR)/include
+  LIBS += -L$$(MACOSX_DEPLOY_DIR)/lib -lGLEW
+  CONFIG += absolute_library_soname
+  headers.files = ../include/opencsg.h
+  headers.path = $$INSTALLDIR/include
+  INSTALLS += target headers
+  target.path = $$INSTALLDIR/lib
+}
+else {
+  DESTDIR = ../lib
+  INCLUDEPATH += ../glew/include
+  INSTALLS += target
+  target.path = $$DESTDIR
+}
 
 HEADERS		= ../include/opencsg.h \
 		  opencsgConfig.h \
@@ -18,12 +39,11 @@
 		  offscreenBuffer.h \
 		  opencsgRender.h \
 		  openglHelper.h \
-		  pBufferTexture.h \
 		  primitiveHelper.h \
 		  scissorMemo.h \
 		  settings.h \
-		  stencilManager.h \
-		  ../RenderTexture/RenderTexture.h
+		  stencilManager.h
+
 SOURCES		= area.cpp \
 		  batch.cpp \
 		  context.cpp \
@@ -34,12 +54,18 @@
 		  offscreenBuffer.cpp \
 		  opencsgRender.cpp \
 		  openglHelper.cpp \
-		  pBufferTexture.cpp \
 		  primitive.cpp \
 		  primitiveHelper.cpp \
 		  renderGoldfeather.cpp \
 		  renderSCS.cpp \
 		  scissorMemo.cpp \
 		  settings.cpp \
-		  stencilManager.cpp \
-		  ../RenderTexture/RenderTexture.cpp
+		  stencilManager.cpp
+
+!macx {
+  HEADERS +=      ../RenderTexture/RenderTexture.h \
+  		  pBufferTexture.h
+
+  SOURCES +=	  ../RenderTexture/RenderTexture.cpp \
+		  pBufferTexture.cpp
+}
