From a3767193cec04a068eda6d75fd86a2de5822e275 Mon Sep 17 00:00:00 2001 From: Erwin Coumans Date: Wed, 27 Apr 2016 09:43:49 -0700 Subject: [PATCH] add example to use BasicDemo with an OpenGL Window, without example browser --- examples/BasicDemo/main.cpp | 34 ++++++++++++++++++++++++++++++++ examples/BasicDemo/premake4.lua | 35 +++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) diff --git a/examples/BasicDemo/main.cpp b/examples/BasicDemo/main.cpp index c6039fc63..fa576f451 100644 --- a/examples/BasicDemo/main.cpp +++ b/examples/BasicDemo/main.cpp @@ -20,7 +20,40 @@ subject to the following restrictions: #include "../CommonInterfaces/CommonGUIHelperInterface.h" +#ifdef USE_GUI +#include "../OpenGLWindow/SimpleOpenGL3App.h" +#include +#include "../ExampleBrowser/OpenGLGuiHelper.h" +int main(int argc, char* argv[]) +{ + + SimpleOpenGL3App* app = new SimpleOpenGL3App("BasicDemoGui",1024,768,true); + OpenGLGuiHelper gui(app,false); + CommonExampleOptions options(&gui); + CommonExampleInterface* example = BasicExampleCreateFunc(options); + + example->initPhysics(); + + int frameCount = 0; + do + { + app->m_instancingRenderer->init(); + app->m_instancingRenderer->updateCamera(); + example->stepSimulation(1./60.); + example->renderScene(); + app->drawGrid(); + app->swapBuffer(); + } while (!app->m_window->requestedExit()); + + example->exitPhysics(); + delete example; + delete app; + return 0; +} + + +#else int main(int argc, char* argv[]) { @@ -38,4 +71,5 @@ int main(int argc, char* argv[]) return 0; } +#endif diff --git a/examples/BasicDemo/premake4.lua b/examples/BasicDemo/premake4.lua index b4901e92b..c55bc2525 100644 --- a/examples/BasicDemo/premake4.lua +++ b/examples/BasicDemo/premake4.lua @@ -20,3 +20,38 @@ files { "**.h", } + +project "App_BasicExampleGui" + +if _OPTIONS["ios"] then + kind "WindowedApp" +else + kind "ConsoleApp" +end +defines {"USE_GUI"} + +includedirs {"../../src"} + +links { + "BulletDynamics","BulletCollision", "LinearMath", "OpenGL_Window","Bullet3Common" +} + + initOpenGL() + initGlew() + + +language "C++" + +files { + "**.cpp", + "**.h", + "../ExampleBrowser/OpenGLGuiHelper.cpp", + "../ExampleBrowser/GL_ShapeDrawer.cpp" +} + +if os.is("Linux") then initX11() end + +if os.is("MacOSX") then + links{"Cocoa.framework"} +end +