Box2D Forums

It is currently Thu May 23, 2013 1:55 pm

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Fri Jun 24, 2011 5:19 pm 
Offline

Joined: Sun Jun 12, 2011 8:18 am
Posts: 7
Hi There,

The testbed does not compile on OSX due to the addition of glutLeaveMainLoop. This is an addition to the freeglut library, which the testbed doesn't seem to built against on OSX. It seems to be build against OSX's GLUT library.

Code:
Linking CXX static library libglui.a
[ 98%] Built target glui
[ 98%] Building CXX object Testbed/CMakeFiles/Testbed.dir/Framework/Main.cpp.o
/Users/Rick/box2d-read-only/Box2D/Testbed/Framework/Main.cpp: In function ‘void Keyboard(unsigned char, int, int)’:
/Users/Rick/box2d-read-only/Box2D/Testbed/Framework/Main.cpp:134: error: ‘glutLeaveMainLoop’ was not declared in this scope
/Users/Rick/box2d-read-only/Box2D/Testbed/Framework/Main.cpp: In function ‘void Exit(int)’:
/Users/Rick/box2d-read-only/Box2D/Testbed/Framework/Main.cpp:334: error: ‘glutLeaveMainLoop’ was not declared in this scope


Thanks
Rick


Top
 Profile  
 
PostPosted: Sat Jun 25, 2011 12:21 am 
Offline
Site Admin

Joined: Thu Sep 06, 2007 12:34 am
Posts: 2931
The testbed should use the provided freeglut.


Top
 Profile  
 
PostPosted: Sat Jun 25, 2011 6:40 am 
Offline

Joined: Sun Jun 12, 2011 8:18 am
Posts: 7
From the start of Box2D/glui/GL/glui.h

Code:
#if defined(GLUI_FREEGLUT)

  // FreeGLUT does not yet work perfectly with GLUI
  //  - use at your own risk.
  #include <GL/freeglut.h>

#elif defined(GLUI_OPENGLUT)

  // OpenGLUT does not yet work properly with GLUI
  //  - use at your own risk.

  #include <GL/openglut.h>

#else

  #ifdef __APPLE__
  #include <GLUT/glut.h>
  #else
        #include "../../freeglut/GL/glut.h"
  //#include <GL/glut.h>
  #endif

#endif


I can confirm that the __APPLE__ specific block is being used, and is including a version of glut that does not support glutLeaveMainLoop() (probably from /System/Library/Frameworks/GLUT.framework/).

** Edit ** I was able to get this to compile by replacing

Code:
#include <GLUT/glut.h>


with

Code:
#include "../../freeglut/GL/glut.h"


Once that was done the process was unable to locate GL/gl.h and GL/glu.h

Not being very familiar w/ cmake, I ultimately added the following to Box2D/CMakeLists.txt (/usr/X11/include are where my GL/gl.h and GL/glu.h are)

Code:
INCLUDE_DIRECTORIES("/usr/X11/include")


I'm sure there is a more elegant way to go about this, but I thought I should let you know.

Rick


Top
 Profile  
 
PostPosted: Mon May 07, 2012 7:22 am 
Offline

Joined: Mon May 07, 2012 7:14 am
Posts: 1
I read this in the readme.txt file in freeglut 2.8.0-1.mp for MinGW:
If you want your application to be compatible with GLUT, you should include <GL/glut.h>. If you want to use freeglut specific extensions, you should include <GL/freeglut.h>instead.

glutLeaveMainLoop is a new feature added in freeglut, so check your include macro.

Just post in case someone still needs the answer.


Top
 Profile  
 
PostPosted: Mon May 07, 2012 9:39 am 
Offline

Joined: Tue Jun 24, 2008 8:25 pm
Posts: 1517
Location: Tokyo
I had noticed this too and usually just comment out those two lines.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group