Skip to content
Snippets Groups Projects
Commit 03212984 authored by vahrenkamp's avatar vahrenkamp
Browse files

bullet/glut/win fix

git-svn-id: http://svn.code.sf.net/p/simox/code/trunk@487 042f3d55-54a8-47e9-b7fb-15903f145c44
parent 7951ac57
No related branches found
No related tags found
No related merge requests found
......@@ -28,13 +28,13 @@
#include "../../DynamicsWorld.h"
#include "BulletEngine.h"
/*#ifdef _WINDOWS
#ifdef _WINDOWS
#include <Win32DemoApplication.h>
#define PlatformDemoApplication Win32DemoApplication
#else*/
#else
#include <GlutDemoApplication.h>
#define PlatformDemoApplication GlutDemoApplication
//#endif
#endif
#include <btBulletDynamicsCommon.h>
#include <GlutStuff.h>
......
......@@ -12,6 +12,117 @@ using namespace std;
using namespace VirtualRobot;
using namespace SimDynamics;
#ifdef WIN32
#include <GL/gl.h>
#include <GL/glut.h>
#include "DemoApplication.h"
//glut is C code, this global gDemoApplication links glut to the C++ demo
static DemoApplication* gDemoApplication = 0;
#include "GlutStuff.h"
static void glutKeyboardCallback(unsigned char key, int x, int y)
{
gDemoApplication->keyboardCallback(key, x, y);
}
static void glutKeyboardUpCallback(unsigned char key, int x, int y)
{
gDemoApplication->keyboardUpCallback(key, x, y);
}
static void glutSpecialKeyboardCallback(int key, int x, int y)
{
gDemoApplication->specialKeyboard(key, x, y);
}
static void glutSpecialKeyboardUpCallback(int key, int x, int y)
{
gDemoApplication->specialKeyboardUp(key, x, y);
}
static void glutReshapeCallback(int w, int h)
{
gDemoApplication->reshape(w, h);
}
static void glutMoveAndDisplayCallback()
{
gDemoApplication->moveAndDisplay();
}
static void glutMouseFuncCallback(int button, int state, int x, int y)
{
gDemoApplication->mouseFunc(button, state, x, y);
}
static void glutMotionFuncCallback(int x, int y)
{
gDemoApplication->mouseMotionFunc(x, y);
}
static void glutDisplayCallback(void)
{
gDemoApplication->displayCallback();
}
int glutmain(int argc, char **argv, int width, int height, const char* title, DemoApplication* demoApp) {
gDemoApplication = demoApp;
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH | GLUT_STENCIL);
glutInitWindowPosition(width / 2, height / 2);
glutInitWindowSize(width, height);
glutCreateWindow(title);
#ifdef BT_USE_FREEGLUT
glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_GLUTMAINLOOP_RETURNS);
#endif
gDemoApplication->myinit();
glutKeyboardFunc(glutKeyboardCallback);
glutKeyboardUpFunc(glutKeyboardUpCallback);
glutSpecialFunc(glutSpecialKeyboardCallback);
glutSpecialUpFunc(glutSpecialKeyboardUpCallback);
glutReshapeFunc(glutReshapeCallback);
//createMenu();
glutIdleFunc(glutMoveAndDisplayCallback);
glutMouseFunc(glutMouseFuncCallback);
glutPassiveMotionFunc(glutMotionFuncCallback);
glutMotionFunc(glutMotionFuncCallback);
glutDisplayFunc(glutDisplayCallback);
glutMoveAndDisplayCallback();
//enable vsync to avoid tearing on Apple (todo: for Windows)
#if defined(__APPLE__) && !defined (VMDMESA)
int swap_interval = 1;
CGLContextObj cgl_context = CGLGetCurrentContext();
CGLSetParameter(cgl_context, kCGLCPSwapInterval, &swap_interval);
#endif
glutMainLoop();
return 0;
}
#endif
int main(int argc,char* argv[])
{
VirtualRobot::RuntimeEnvironment::considerKey("robot");
......
......@@ -6,6 +6,8 @@ CMAKE_POLICY(VERSION 2.6)
INCLUDE(${Simox_DIR}/CMakeModules/SimoxMacros.cmake)
include_directories(${GLUT_INCLUDE_DIR})
#message("GLUT_INCLUDE_DIR:${GLUT_INCLUDE_DIR}")
# create the executable
SimoxApplication(${PROJECT_NAME} "BulletDebugViewerGlut.cpp" "")
TARGET_LINK_LIBRARIES(${PROJECT_NAME} SimDynamics)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment