add example to use BasicDemo with an OpenGL Window, without example browser

This commit is contained in:
Erwin Coumans
2016-04-27 09:43:49 -07:00
parent 924456548e
commit a3767193ce
2 changed files with 69 additions and 0 deletions

View File

@@ -20,7 +20,40 @@ subject to the following restrictions:
#include "../CommonInterfaces/CommonGUIHelperInterface.h" #include "../CommonInterfaces/CommonGUIHelperInterface.h"
#ifdef USE_GUI
#include "../OpenGLWindow/SimpleOpenGL3App.h"
#include <stdio.h>
#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[]) int main(int argc, char* argv[])
{ {
@@ -38,4 +71,5 @@ int main(int argc, char* argv[])
return 0; return 0;
} }
#endif

View File

@@ -20,3 +20,38 @@ files {
"**.h", "**.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