From 2c6e85442bcd88e020185f633409c2accf130950 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 3 Oct 2001 21:44:07 +0000 Subject: [PATCH] Integrated changes for MacOSX, submitted by Phil Atkin, with small mods by Robert Osfield to maintain compatability under Linux. --- AUTHORS | 5 +- INSTALL | 95 +++++++++++++++++++++++++---- Make/makedefs.macosx | 62 +++++++++++++++++++ Make/makerules.macosx | 59 ++++++++++++++++++ Makefile | 7 +++ include/osg/GL | 6 +- include/osg/GLU | 10 +++ include/osg/Math | 72 ++++++++++++++++++++++ include/osg/Notify | 32 +++++----- include/osg/Timer | 16 ++++- include/osg/Types | 28 --------- include/osg/Vec2 | 2 +- include/osg/Vec3 | 2 +- include/osg/Vec4 | 2 +- include/osgGLUT/glut | 10 +++ src/Demos/hangglide/hangglide.cpp | 2 +- src/Demos/hangglide/hat.cpp | 4 +- src/Demos/osgcube/osgcube.cpp | 5 +- src/Demos/osgreflect/osgreflect.cpp | 2 +- src/Demos/sgv/sgv.cpp | 2 +- src/osg/Image.cpp | 9 +-- src/osg/Notify.cpp | 15 +++-- src/osg/State.cpp | 2 +- src/osg/Texture.cpp | 6 +- src/osg/Timer.cpp | 16 +++++ src/osgGLUT/GLUTEventAdapter.cpp | 2 +- src/osgGLUT/Viewer.cpp | 6 +- src/osgUtil/SceneView.cpp | 2 +- src/osgUtil/Tesselator.cpp | 5 +- 29 files changed, 395 insertions(+), 91 deletions(-) create mode 100644 Make/makedefs.macosx create mode 100644 Make/makerules.macosx create mode 100644 include/osg/GLU create mode 100644 include/osg/Math create mode 100644 include/osgGLUT/glut diff --git a/AUTHORS b/AUTHORS index 471c57ca7..7c40c0f0d 100644 --- a/AUTHORS +++ b/AUTHORS @@ -47,12 +47,15 @@ Ben Discoe Byan Woods - Port to MacOS, various code changes to support this. - - Metrowerks CodeWarrior makefiles. + - Metrowerks CodeWarrior makefiles. Randall Hopper - port to FreeBSD. - warning fixes to IRIX compilation. +Phil Akin + - port to OSX. + Ulrich Hertlein - support for IBM Mirror Repeat extension in osg::Texture - support for texture subloading in osg::Texture diff --git a/INSTALL b/INSTALL index 2d637b2ed..cb21e5c30 100644 --- a/INSTALL +++ b/INSTALL @@ -29,7 +29,7 @@ If you haven't already checked it out, for a list of distribution contents, contacts and links to documentation check out index.html. -Environmental settings under Unix: +Environmental settings under Unix --------------------------------- These enviromental settings are useful to help develop with an @@ -57,8 +57,8 @@ Environmental settings under Unix: note: under IRIX you'll need to use LD_LIBRARYN32_PATH instead of LD_LIBRARY_PATH. -Compiling under Linux : ------------------------ +Compiling under Linux +--------------------- To compile, from the OSG root directory, type: @@ -83,8 +83,8 @@ Compiling under Linux : make help -Compiling under FreeBSD : -------------------------- +Compiling under FreeBSD +----------------------- To compile, from the OSG root directory, type : @@ -104,8 +104,8 @@ Compiling under FreeBSD : make help -Compiling under IRIX : ----------------------- +Compiling under IRIX +-------------------- When setting up environmental variables, specified above, LD_LIBRARY_PATH should of course be replaced by LD_LIBRARYN32_PATH. @@ -140,8 +140,8 @@ Compiling under IRIX : make help -Compiling under Windows : -------------------------- +Compiling under Windows +----------------------- The Microsoft Visual C++ 6.0 workspace file is VisualStudio.dsw located in the VisualStudio\ below the OSG this root directory. The OSG will @@ -174,8 +174,9 @@ Compiling under Windows : have been zipped up for your convienice, your find these on the OSG release download directory. -Compiling under Mac : ---------------------- + +Compiling under MacOS 9 +----------------------- The Microwerks Codewarrior workspace files can be found under the Microwerks directory. Further details to be fleshed out since @@ -185,6 +186,78 @@ Compiling under Mac : have time to maintian the port please email robert@openscenegraph.org. +Compiling under MacOS X (instructions written by Phil Atkin) +------------------------------------------------------------ + + For anyone who's ever used a Unix box for development it really is so simple + it's insane. + + You need to have installed the Developer tools from the CD that comes for + free with OS X. This gives you compilers, headers, frameworks - stuff like + GLUT and Carbon for developers. + + Everything is done command-line, so you need to get to the underlying OS + rather than the Aqua gloss. The Mac comes with an app in + Applications/Utilities called Terminal - open up any Finder window (e.g + double-click on your hard disk icon), click on the Applications icon at the + top right of the window, then click on the Utilities folder to get access to + all the grubby apps which give away the real OS roots underneath the shiny + paintwork. Anyone developing will need Terminal so much they should put it + in their Dock. You do that by grabbing the icon of the app in the Utilities + folder and dragging it to the bottom of your screen, at which point the + other app icons in the Dock slide away to leave a gap which when you release + the mouse button leaves Terminal permanently available, just a mouse click + away on your desktop. When you start Terminal it brings you up a csh + running under Darwin (which is the BSD-with-knobs-on that underlies OS X), + and does a cd to ~ (otherwise /Users/username of whoever you are logged in + as, as far as the Finder in OS X is concerned you are in the Users/username + folder of the harddisk the machine booted from). + + Then you are in Unix land, and it's all very familiar. + + You will need a .cshrc file with $OSGHOME (as in your instructions), and + this is a filename that the Mac won't let you see from the Finder or in fact + generate from an app, so I used vi to create that. Then I just went + + cd $OSGHOME + make clean + make macosx + + And it sounds too good to be true but it is that simple. It's worth doing + some editing on the Makefiles in the Plugins and Demos directories so that + it only tries to build a subset, otherwise the developer will have to dig + out the support projects like jpeg etc. I have only built up to now sgv, + hangglide, osgcube, osgreflect, osgviews and in the Plugins have built osg + rgb 3ds and a couple others - will check and get back to you. + + Tricky bit - + Installing the libdl.a is more trouble, as you have to enable the root + account on the machine, which by default is switched off as the machines + ship for security reasons. Rather than typing in and risking error through + paraphrase, here is a link to a site which tells you how to do this - + + http://www.macos.utah.edu/Documentation/macosx/security/enablerootuser.html + + Or alternately + + http://www.thinkmacintosh.com/osxfaq.html + + + One you have a root account enabled, you have to su root you cd to the + directory which the Fink installer generates, and it puts libdl.a and the + associated .h files in sensible system places so the compiler just finds + them. + + There is one oddball problem - if you rely on Path to find the resulting + executables, a weird Core Graphics error occurs - so even though I set up my + path to include $(OSGHOME)/bin, and when I cd to $OSGHOME and type for + example hangglide, the application starts fine (so it is in the path), but + at the point it tries to use GLUT to open a window it falls over with a CGS + error (which is I think Core Graphics System). If you explicitly go + bin/hangglide it works fine. Weird, it may be an OS X 10.04 issue which is + gone in 10.1 or it may be a weirdy in the Mac GLUT implementation, but + forewarned is forearmed. + Running the demos ----------------- diff --git a/Make/makedefs.macosx b/Make/makedefs.macosx new file mode 100644 index 000000000..b0580e4db --- /dev/null +++ b/Make/makedefs.macosx @@ -0,0 +1,62 @@ +MAKEDIR = $(OSGHOME)/Make +INSTRULES = $(MAKEDIR)/instrules +MAKEDEPEND = Makedepend +OBJS = $(C++FILES:.cpp=.o) $(CFILES:.c=.o) $(YACCFILES:.y=.o) $(LEXFILES:.l=.o) + +DEPFILES = $(OBJS:.o=.d) + +C++ = cc +YFLAGS = -d +LCINCS += -I/usr/local/include +LC++INCS += ${LCINCS} +CFLAGS = -O2 -W -Wall $(LCINCS) +C++FLAGS = ${CFLAGS} +CPPFLAGS = ${CFLAGS} +LIBTOOL = libtool +LD = ld +PLUGINLIBS = ../../../lib/osgPlugins/osgdb_rgb.so ../../../lib/osgPlugins/osgdb_3ds.so ../../../lib/osgPlugins/osgdb_osg.so +MACOSXLIBS = ../../../lib/libosg.so ../../../lib/libosgUtil.so ../../../lib/libosgGLUT.so ../../../lib/libosgDB.so +PLUGINS = $(PLUGINLIBS) + +LDFLAGS = -all_load -framework GLUT -framework Carbon -L/usr/local/lib -L/usr/lib -L../../../lib/osgPlugins -ldl -lstdc++ -lm + + +DYNAMICLIBRARYLIB = +PFLIBS = + +# +# TARGET_DIRS are directories that would not exist on the system except +# for the presence of OpenSceneGraph. 'make instclean' removes these +# directories +# +TARGET_DIRS = \ + /usr/include/osg \ + /usr/include/osgDB \ + /usr/include/osgGLUT \ + /usr/include/osgUtil \ + /usr/share/OpenSceneGraph\ + /usr/share/OpenSceneGraph/data\ + /usr/share/OpenSceneGraph/data/Images\ + /usr/share/OpenSceneGraph/data/Test\ + /usr/lib/osgPlugins\ + +TARGET_BIN = /usr/bin +TARGET_LIB = /usr/lib +TARGET_INCLUDE = /usr/include +TARGET_DATA = /usr/share/OpenSceneGraph/data + +# +# This definitions are necessary for IRIX. The following statement +# does not work for smake using a sh: +# +# for variable in $(LIST); do ...; done +# +# .. if $(LIST) is a NULL variable. So we have to define 0 length +# strings and check for them inside the for loop +# + +TARGET_LIB_FILES = "" +TARGET_BIN_FILES = "" +TARGET_INCLUDE_FILES = "" +TARGET_DATA_FILES = "" +TARGET_LOADER_FILES = "" diff --git a/Make/makerules.macosx b/Make/makerules.macosx new file mode 100644 index 000000000..eacf7e98e --- /dev/null +++ b/Make/makerules.macosx @@ -0,0 +1,59 @@ + +all : $(MAKEDEPEND) $(TARGET) $(LIB) $(DYLIB) + +$(TARGET) : $(OBJS) $(PLUGINLIBS) $(MACOSXLIBS) + $(C++) $(LDFLAGS) $(MACOSXLIBS) $(OBJS) $(PLUGINS) -o $@ + +$(LIB) : $(OBJS) + $(LIBTOOL) -static -o $@ $(OBJS) + +$(DYLIB) : $(OBJS) + $(LIBTOOL) -static -o $@ $(OBJS) + +clean : + rm -f $(OBJS) core $(TARGET) $(MAKEDEPEND) + touch $(MAKEDEPEND) + +clobber : clean + rm -f $(TARGET) a.out $(LIB) + +to_unix : + for f in *.cpp ; do to_unix $$f $$f; done + for f in *.h ; do to_unix $$f $$f; done + +# force it +depend : + $(C++) $(C++FLAGS) -M $(C++FILES) $(CFILES) > $(MAKEDEPEND) + +$(MAKEDEPEND) : $(C++FILES) $(CFILES) + $(C++) $(C++FLAGS) -M $(C++FILES) $(CFILES) > $(MAKEDEPEND) + +%.o : %.cpp + $(C++) $(C++FLAGS) -c $*.cpp -o $*.o + +%.o : %.c + $(C++) $(C++FLAGS) -c $*.c -o $*.o + +docs: + [ "$(TARGET_BASENAME)" != "" ] && \ + mkdir -p ../../doc/doc++/$(TARGET_BASENAME) && \ + doc++ -d ../../doc/doc++/$(TARGET_BASENAME) -H -A ../../include/$(TARGET_BASENAME)/* && \ + echo $(TARGET_BASENAME) HTML documentation created in ../../doc/doc++/$(TARGET_BASENAME) + +install : home + @ $(MAKE) __install + +instlinks : home + @ $(MAKE) __instlinks + +instclean : home + @ $(MAKE) __instclean + + +home : + @ [ -n "$(OSGHOME)" ] || (echo ; echo "-------------> Please define OSGHOME"; echo) + @ [ -n "$(OSGHOME)" ] && echo > /dev/null; + +sinclude $(INSTRULES) + +include $(MAKEDEPEND) diff --git a/Makefile b/Makefile index cc11a79df..a151173c6 100644 --- a/Makefile +++ b/Makefile @@ -56,6 +56,13 @@ irix.old: ln -sf makerules.irix makerules $(MAKE) +macosx: + cd Make;\ + ln -sf makedefs.macosx makedefs;\ + ln -sf makerules.macosx makerules + $(MAKE) + + help : @echo Usage : @echo \ $(MAKE) diff --git a/include/osg/GL b/include/osg/GL index d59b72369..36ad97c58 100644 --- a/include/osg/GL +++ b/include/osg/GL @@ -5,7 +5,11 @@ // non windows, doesn't require nonsense as seen below :-) #ifndef __gl_h_ - #include + #ifdef __APPLE_CC__ + #include + #else + #include + #endif #endif // required for compatibility with glext.h sytle function definitions of diff --git a/include/osg/GLU b/include/osg/GLU new file mode 100644 index 000000000..9fd6a0610 --- /dev/null +++ b/include/osg/GLU @@ -0,0 +1,10 @@ +#ifndef OSG_GLU +#define OSG_GL 1 + +#ifdef __APPLE_CC__ + #include +#else + #include +#endif + +#endif // __osgGL_h diff --git a/include/osg/Math b/include/osg/Math new file mode 100644 index 000000000..073ff5a22 --- /dev/null +++ b/include/osg/Math @@ -0,0 +1,72 @@ +#ifndef __OSG_MATH +#define __OSG_MATH + +#include + +// #define USE_DEGREES_INTERNALLY + +#if defined(WIN32) || defined (macintosh) + #define M_E 2.7182818284590452354 + #define M_LOG2E 1.4426950408889634074 + #define M_LOG10E 0.43429448190325182765 + #define M_LN2 0.69314718055994530942 + #define M_LN10 2.30258509299404568402 + #define M_PI 3.14159265358979323846 + #define M_PI_2 1.57079632679489661923 + #define M_PI_4 0.78539816339744830962 + #define M_1_PI 0.31830988618379067154 + #define M_2_PI 0.63661977236758134308 + #define M_2_SQRTPI 1.12837916709551257390 + #define M_SQRT2 1.41421356237309504880 + #define M_SQRT1_2 0.70710678118654752440 +#endif + +// PJA MAC OSX +// This appears to be the simplest way to get these defined under MACOSX +// where they arent in math.h + +#ifndef acosf +#define acosf acos +#endif + +#ifndef asinf +#define asinf asin +#endif + +#ifndef cosf +#define cosf cos +#endif + +#ifndef sinf +#define sinf sin +#endif + +#ifndef logf +#define logf log +#endif + +#ifndef floorf +#define floorf floor +#endif + +#ifndef powf +#define powf pow +#endif + +#ifndef sqrtf +#define sqrtf sqrt +#endif + +namespace osg { + +#ifdef USE_DEGREES_INTERNALLY +inline double inDegrees(float angle) { return angle; } +inline double inRadians(float angle) { return angle*180.0/M_PI; } +#else +inline double inDegrees(float angle) { return angle*M_PI/180.0; } +inline double inRadians(float angle) { return angle; } +#endif + +}; + +#endif // __OSG_MATH diff --git a/include/osg/Notify b/include/osg/Notify index 3f8dd142c..c9edafa34 100644 --- a/include/osg/Notify +++ b/include/osg/Notify @@ -34,6 +34,12 @@ enum NotifySeverity { /** global notify level. */ SG_EXPORT extern NotifySeverity g_NotifyLevel; +/** global notify nul stream. added for Mac OSX */ +SG_EXPORT extern ofstream *g_NotifyNulStream; + +/** global notify nul stream. added for Mac OSX */ +SG_EXPORT extern bool g_NotifyInit; + /** set the notify level, overriding the default or value set by * the environmental variable OSGNOTIFYLEVEL. */ @@ -59,31 +65,25 @@ SG_EXPORT extern bool initNotifyLevel(); * with your code simply use the notify function as a normal file * stream (like cout) i.e osg::notify(osg::DEBUG) << "Hello Bugs!"< typedef std::clock_t Timer_t; @@ -27,8 +29,14 @@ class SG_EXPORT Timer { Timer(); ~Timer() {} - inline Timer_t tick(); - + #ifdef __APPLE__ + // PJA MAC OSX - inline Tick() pollutes namespace so badly + // we cant compile, due to Carbon.h ... + Timer_t tick(); + #else + inline Timer_t tick(); + #endif + inline double delta_s( Timer_t t1, Timer_t t2 ) const { return (double)(t2 - t1)*_secsPerClick; } inline double delta_m( Timer_t t1, Timer_t t2 ) const { return delta_s(t1,t2)*1e3; } inline double delta_u( Timer_t t1, Timer_t t2 ) const { return delta_s(t1,t2)*1e6; } @@ -138,7 +146,7 @@ namespace osg{ } }; -#else +#elif !defined (__APPLE_CC__) // no choice, always use std::clock() @@ -149,4 +157,6 @@ namespace osg{ #endif +// note, MacOSX compiled in the Timer.cpp. + #endif diff --git a/include/osg/Types b/include/osg/Types index 9975e33ec..3a51f40cd 100644 --- a/include/osg/Types +++ b/include/osg/Types @@ -8,34 +8,6 @@ typedef unsigned short ushort; typedef unsigned char uchar; typedef uchar ubyte; -#if defined(WIN32) || defined (macintosh) -#define M_E 2.7182818284590452354 -#define M_LOG2E 1.4426950408889634074 -#define M_LOG10E 0.43429448190325182765 -#define M_LN2 0.69314718055994530942 -#define M_LN10 2.30258509299404568402 -#define M_PI 3.14159265358979323846 -#define M_PI_2 1.57079632679489661923 -#define M_PI_4 0.78539816339744830962 -#define M_1_PI 0.31830988618379067154 -#define M_2_PI 0.63661977236758134308 -#define M_2_SQRTPI 1.12837916709551257390 -#define M_SQRT2 1.41421356237309504880 -#define M_SQRT1_2 0.70710678118654752440 -#else -#include -#endif - -#define USE_DEGREES_INTERNALLY - -#ifdef USE_DEGREES_INTERNALLY -inline double inDegrees(float angle) { return angle; } -inline double inRadians(float angle) { return angle*180.0/M_PI; } -#else -inline double inDegrees(float angle) { return angle*M_PI/180.0; } -inline double inRadians(float angle) { return angle; } -#endif - }; #endif diff --git a/include/osg/Vec2 b/include/osg/Vec2 index bea9b1cb3..4e247e984 100644 --- a/include/osg/Vec2 +++ b/include/osg/Vec2 @@ -1,7 +1,7 @@ #ifndef OSG_VEC2 #define OSG_VEC2 1 -#include +#include #ifdef OSG_USE_IO_DOT_H #include diff --git a/include/osg/Vec3 b/include/osg/Vec3 index 63a0fbd6d..648540bc7 100644 --- a/include/osg/Vec3 +++ b/include/osg/Vec3 @@ -1,7 +1,7 @@ #ifndef OSG_VEC3 #define OSG_VEC3 1 -#include +#include #ifdef OSG_USE_IO_DOT_H #include diff --git a/include/osg/Vec4 b/include/osg/Vec4 index 2abe02312..4755fc957 100644 --- a/include/osg/Vec4 +++ b/include/osg/Vec4 @@ -1,7 +1,7 @@ #ifndef OSG_VEC4 #define OSG_VEC4 1 -#include +#include #ifdef OSG_USE_IO_DOT_H #include diff --git a/include/osgGLUT/glut b/include/osgGLUT/glut new file mode 100644 index 000000000..d04cd8e08 --- /dev/null +++ b/include/osgGLUT/glut @@ -0,0 +1,10 @@ +#ifndef OSG_GLU +#define OSG_GL 1 + +#ifdef __APPLE__ + #include +#else + #include +#endif + +#endif // __osgGL_h diff --git a/src/Demos/hangglide/hangglide.cpp b/src/Demos/hangglide/hangglide.cpp index 6a1317f66..b638e2d84 100644 --- a/src/Demos/hangglide/hangglide.cpp +++ b/src/Demos/hangglide/hangglide.cpp @@ -7,7 +7,7 @@ #include #include -#include +#include #include #include "GliderManipulator.h" diff --git a/src/Demos/hangglide/hat.cpp b/src/Demos/hangglide/hat.cpp index 0aa57c52f..9f7f14ea1 100644 --- a/src/Demos/hangglide/hat.cpp +++ b/src/Demos/hangglide/hat.cpp @@ -3,8 +3,8 @@ #pragma warning( disable : 4244 ) #endif -#include -#include +#include +#include #include #include "terrain_data.h" diff --git a/src/Demos/osgcube/osgcube.cpp b/src/Demos/osgcube/osgcube.cpp index f4bac89ec..6362ebdf2 100644 --- a/src/Demos/osgcube/osgcube.cpp +++ b/src/Demos/osgcube/osgcube.cpp @@ -10,10 +10,9 @@ #include #include +#include -#include - -#include +#include // ---------------------------------------------------------------------- // Global variables - this is basically the stuff which will be animated diff --git a/src/Demos/osgreflect/osgreflect.cpp b/src/Demos/osgreflect/osgreflect.cpp index cf6d4cc8a..71db281e8 100644 --- a/src/Demos/osgreflect/osgreflect.cpp +++ b/src/Demos/osgreflect/osgreflect.cpp @@ -16,7 +16,7 @@ #include #include -#include +#include #include diff --git a/src/Demos/sgv/sgv.cpp b/src/Demos/sgv/sgv.cpp index 06cbd3f9e..b8b8934af 100644 --- a/src/Demos/sgv/sgv.cpp +++ b/src/Demos/sgv/sgv.cpp @@ -12,7 +12,7 @@ #include #include -#include +#include #include #include diff --git a/src/osg/Image.cpp b/src/osg/Image.cpp index 35011809b..539083d32 100644 --- a/src/osg/Image.cpp +++ b/src/osg/Image.cpp @@ -1,13 +1,14 @@ -#include "osg/Image" -#include "osg/GL" -#include "osg/Notify" +#include +#include + +#include +#include #include #include #include #include -#include using namespace osg; diff --git a/src/osg/Notify.cpp b/src/osg/Notify.cpp index c0ec13144..46a65a995 100644 --- a/src/osg/Notify.cpp +++ b/src/osg/Notify.cpp @@ -2,6 +2,8 @@ #include osg::NotifySeverity osg::g_NotifyLevel = osg::NOTICE; +ofstream *osg::g_NotifyNulStream; +bool osg::g_NotifyInit = false; void osg::setNotifyLevel(osg::NotifySeverity severity) { @@ -19,11 +21,16 @@ osg::NotifySeverity osg::getNotifyLevel() bool osg::initNotifyLevel() { - static bool s_local_intialized = false; + if (g_NotifyInit) return true; - if (s_local_intialized) return true; - - s_local_intialized = true; + g_NotifyInit = true; + + // set up global notify null stream for inline notify +#ifdef WIN32 + g_NotifyNulStream = new ofstream ("nul"); +#else + g_NotifyNulStream = new ofstream ("/dev/null"); +#endif // g_NotifyLevel // ============= diff --git a/src/osg/State.cpp b/src/osg/State.cpp index 3a14e7d56..c401a4866 100644 --- a/src/osg/State.cpp +++ b/src/osg/State.cpp @@ -1,7 +1,7 @@ #include #include -#include +#include using namespace osg; diff --git a/src/osg/Texture.cpp b/src/osg/Texture.cpp index d09abf3f4..4c5c6952d 100644 --- a/src/osg/Texture.cpp +++ b/src/osg/Texture.cpp @@ -9,7 +9,7 @@ #include #include -#include +#include using namespace osg; @@ -176,7 +176,7 @@ void Texture::apply(State& state) const const uint contextID = state.getContextID(); // get the globj for the current contextID. - uint& handle = getHandle(contextID); + GLuint& handle = getHandle(contextID); // For multi-texturing will need something like... // glActiveTextureARB((GLenum)(GL_TEXTURE0_ARB+_textureUnit)); @@ -548,7 +548,7 @@ void Texture::copyTexSubImage2D(State& state, int xoffset, int yoffset, int x, i const uint contextID = state.getContextID(); // get the globj for the current contextID. - uint& handle = getHandle(contextID); + GLuint& handle = getHandle(contextID); if (handle) { diff --git a/src/osg/Timer.cpp b/src/osg/Timer.cpp index dfce9b883..04e808e61 100644 --- a/src/osg/Timer.cpp +++ b/src/osg/Timer.cpp @@ -180,7 +180,23 @@ using namespace osg; _secsPerClick = (double)(cycleval)* 1e-12; } } +#elif defined (__APPLE_CC__) // MACOSX PJA +#include // do I really have to link against the Carbon framework just for this? +Timer_t Timer::tick(void) +{ + UnsignedWide usecs; + Microseconds(&usecs); + + return (usecs.hi * 4294967296.0) + usecs.lo; +} + +Timer::Timer( void ) +{ + _useStandardClock = false; + _secsPerClick = 1e-6; // Carbon timer's precision. + +} #elif defined(unix) diff --git a/src/osgGLUT/GLUTEventAdapter.cpp b/src/osgGLUT/GLUTEventAdapter.cpp index 92ebd1301..b777abdcd 100644 --- a/src/osgGLUT/GLUTEventAdapter.cpp +++ b/src/osgGLUT/GLUTEventAdapter.cpp @@ -1,5 +1,5 @@ #include "osgGLUT/GLUTEventAdapter" -#include "GL/glut.h" +#include using namespace osgGLUT; diff --git a/src/osgGLUT/Viewer.cpp b/src/osgGLUT/Viewer.cpp index 234dfc0c4..e88f612c8 100644 --- a/src/osgGLUT/Viewer.cpp +++ b/src/osgGLUT/Viewer.cpp @@ -8,7 +8,7 @@ #include #endif #include -#include +#include #include @@ -48,7 +48,7 @@ #define USE_GLUT #endif -#include +#include #ifdef WIN32 #include @@ -1049,7 +1049,7 @@ void Viewer::keyboard(unsigned char key, int x, int y) if (_printStats>4) _printStats=0; if (_printStats==4) { // count depth complexity by incrementing the stencil buffer every // time a pixel is hit - int nsten=0; // Number of stencil planes available + GLint nsten=0; // Number of stencil planes available glGetIntegerv(GL_STENCIL_BITS , &nsten); if (nsten>0) { glEnable(GL_STENCIL_TEST); diff --git a/src/osgUtil/SceneView.cpp b/src/osgUtil/SceneView.cpp index 82540c032..f5cb78fd5 100644 --- a/src/osgUtil/SceneView.cpp +++ b/src/osgUtil/SceneView.cpp @@ -6,7 +6,7 @@ #include #include -#include +#include using namespace osg; using namespace osgUtil; diff --git a/src/osgUtil/Tesselator.cpp b/src/osgUtil/Tesselator.cpp index 094fd5a3f..aafc6beae 100644 --- a/src/osgUtil/Tesselator.cpp +++ b/src/osgUtil/Tesselator.cpp @@ -1,10 +1,9 @@ #include +#include + #include #include -#include - - using namespace osg; using namespace osgUtil;