2015-04-16 16:55:32 +00:00
|
|
|
#include "OpenGLExampleBrowser.h"
|
|
|
|
#include "LinearMath/btQuickprof.h"
|
|
|
|
#include "../OpenGLWindow/OpenGLInclude.h"
|
|
|
|
#include "../OpenGLWindow/SimpleOpenGL2App.h"
|
2015-05-06 17:35:14 +00:00
|
|
|
#ifndef NO_OPENGL3
|
2015-04-16 16:55:32 +00:00
|
|
|
#include "../OpenGLWindow/SimpleOpenGL3App.h"
|
2015-05-06 17:35:14 +00:00
|
|
|
#endif
|
2015-04-16 16:55:32 +00:00
|
|
|
#include "../CommonInterfaces/CommonRenderInterface.h"
|
|
|
|
#ifdef __APPLE__
|
2015-04-16 22:52:30 +00:00
|
|
|
#include "../OpenGLWindow/MacOpenGLWindow.h"
|
2015-04-16 16:55:32 +00:00
|
|
|
#else
|
|
|
|
#ifdef _WIN32
|
|
|
|
#include "../OpenGLWindow/Win32OpenGLWindow.h"
|
|
|
|
#else
|
|
|
|
//let's cross the fingers it is Linux/X11
|
|
|
|
#include "../OpenGLWindow/X11OpenGLWindow.h"
|
|
|
|
#endif //_WIN32
|
|
|
|
#endif//__APPLE__
|
|
|
|
#include "../ThirdPartyLibs/Gwen/Renderers/OpenGL_DebugFont.h"
|
|
|
|
|
|
|
|
#include "Bullet3Common/b3Vector3.h"
|
|
|
|
#include "assert.h"
|
|
|
|
#include <stdio.h>
|
|
|
|
#include "GwenGUISupport/gwenInternalData.h"
|
|
|
|
#include "GwenGUISupport/gwenUserInterface.h"
|
|
|
|
#include "../Utils/b3Clock.h"
|
|
|
|
#include "GwenGUISupport/GwenParameterInterface.h"
|
|
|
|
#include "GwenGUISupport/GwenProfileWindow.h"
|
|
|
|
#include "GwenGUISupport/GwenTextureWindow.h"
|
|
|
|
#include "GwenGUISupport/GraphingTexture.h"
|
|
|
|
#include "../CommonInterfaces/Common2dCanvasInterface.h"
|
2015-04-29 20:33:26 +00:00
|
|
|
#include "../CommonInterfaces/CommonExampleInterface.h"
|
2015-04-16 16:55:32 +00:00
|
|
|
#include "Bullet3Common/b3CommandLineArgs.h"
|
|
|
|
#include "../OpenGLWindow/SimpleCamera.h"
|
|
|
|
#include "../OpenGLWindow/SimpleOpenGL2Renderer.h"
|
|
|
|
#include "ExampleEntries.h"
|
|
|
|
#include "OpenGLGuiHelper.h"
|
2015-05-01 23:27:09 +00:00
|
|
|
#include "Bullet3Common/b3FileUtils.h"
|
|
|
|
|
2015-04-16 16:55:32 +00:00
|
|
|
#include "LinearMath/btIDebugDraw.h"
|
2015-05-01 18:42:14 +00:00
|
|
|
//quick test for file import, @todo(erwincoumans) make it more general and add other file formats
|
|
|
|
#include "../Importers/ImportURDFDemo/ImportURDFSetup.h"
|
2015-05-01 23:27:09 +00:00
|
|
|
#include "../Importers/ImportBullet/SerializeSetup.h"
|
2015-05-01 18:42:14 +00:00
|
|
|
|
2016-07-16 07:55:56 +00:00
|
|
|
#include "Bullet3Common/b3HashMap.h"
|
|
|
|
|
|
|
|
struct GL3TexLoader : public MyTextureLoader
|
|
|
|
{
|
|
|
|
b3HashMap<b3HashString, GLint> m_hashMap;
|
|
|
|
|
|
|
|
virtual void LoadTexture(Gwen::Texture* pTexture)
|
|
|
|
{
|
|
|
|
Gwen::String namestr = pTexture->name.Get();
|
|
|
|
const char* n = namestr.c_str();
|
|
|
|
GLint* texIdPtr = m_hashMap[n];
|
|
|
|
if (texIdPtr)
|
|
|
|
{
|
|
|
|
pTexture->m_intData = *texIdPtr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
virtual void FreeTexture(Gwen::Texture* pTexture)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct OpenGLExampleBrowserInternalData
|
|
|
|
{
|
|
|
|
Gwen::Renderer::Base* m_gwenRenderer;
|
|
|
|
CommonGraphicsApp* m_app;
|
|
|
|
// MyProfileWindow* m_profWindow;
|
|
|
|
btAlignedObjectArray<Gwen::Controls::TreeNode*> m_nodes;
|
|
|
|
GwenUserInterface* m_gui;
|
|
|
|
GL3TexLoader* m_myTexLoader;
|
|
|
|
struct MyMenuItemHander* m_handler2;
|
|
|
|
btAlignedObjectArray<MyMenuItemHander*> m_handlers;
|
|
|
|
|
|
|
|
OpenGLExampleBrowserInternalData()
|
|
|
|
: m_gwenRenderer(0),
|
|
|
|
m_app(0),
|
|
|
|
// m_profWindow(0),
|
|
|
|
m_gui(0),
|
|
|
|
m_myTexLoader(0),
|
|
|
|
m_handler2(0)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2015-04-29 20:21:26 +00:00
|
|
|
static CommonGraphicsApp* s_app=0;
|
2015-04-16 16:55:32 +00:00
|
|
|
|
2015-04-29 20:21:26 +00:00
|
|
|
static CommonWindowInterface* s_window = 0;
|
|
|
|
static CommonParameterInterface* s_parameterInterface=0;
|
|
|
|
static CommonRenderInterface* s_instancingRenderer=0;
|
|
|
|
static OpenGLGuiHelper* s_guiHelper=0;
|
2016-07-16 07:55:56 +00:00
|
|
|
//static MyProfileWindow* s_profWindow =0;
|
2016-03-10 22:36:46 +00:00
|
|
|
static SharedMemoryInterface* sSharedMem = 0;
|
2015-04-16 16:55:32 +00:00
|
|
|
|
|
|
|
#define DEMO_SELECTION_COMBOBOX 13
|
2015-08-06 02:03:27 +00:00
|
|
|
const char* startFileName = "0_Bullet3Demo.txt";
|
2015-08-07 23:05:03 +00:00
|
|
|
char staticPngFileName[1024];
|
2016-07-16 07:55:56 +00:00
|
|
|
//static GwenUserInterface* gui = 0;
|
|
|
|
static GwenUserInterface* gui2 = 0;
|
2015-05-01 18:42:14 +00:00
|
|
|
static int sCurrentDemoIndex = -1;
|
2015-04-16 16:55:32 +00:00
|
|
|
static int sCurrentHightlighted = 0;
|
2015-04-29 20:33:26 +00:00
|
|
|
static CommonExampleInterface* sCurrentDemo = 0;
|
2015-04-16 16:55:32 +00:00
|
|
|
static b3AlignedObjectArray<const char*> allNames;
|
2015-08-07 21:18:57 +00:00
|
|
|
static float gFixedTimeStep = 0;
|
2015-08-07 23:05:03 +00:00
|
|
|
bool gAllowRetina = true;
|
2016-08-13 19:21:18 +00:00
|
|
|
bool gDisableDemoSelection = false;
|
2015-04-16 16:55:32 +00:00
|
|
|
static class ExampleEntries* gAllExamples=0;
|
2015-04-20 22:28:52 +00:00
|
|
|
bool sUseOpenGL2 = false;
|
2015-04-16 16:55:32 +00:00
|
|
|
bool drawGUI=true;
|
2015-05-06 17:35:14 +00:00
|
|
|
#ifndef USE_OPENGL3
|
2015-04-16 16:55:32 +00:00
|
|
|
extern bool useShadowMap;
|
2015-05-06 17:35:14 +00:00
|
|
|
#endif
|
|
|
|
|
2015-04-16 16:55:32 +00:00
|
|
|
static bool visualWireframe=false;
|
|
|
|
static bool renderVisualGeometry=true;
|
|
|
|
static bool renderGrid = true;
|
2015-10-30 17:30:48 +00:00
|
|
|
static bool renderGui = true;
|
2015-08-05 01:24:30 +00:00
|
|
|
static bool enable_experimental_opencl = false;
|
|
|
|
|
2015-05-02 18:40:06 +00:00
|
|
|
int gDebugDrawFlags = 0;
|
2015-04-16 16:55:32 +00:00
|
|
|
static bool pauseSimulation=false;
|
2016-08-19 17:30:02 +00:00
|
|
|
static bool singleStepSimulation = false;
|
2015-04-16 16:55:32 +00:00
|
|
|
int midiBaseIndex = 176;
|
|
|
|
extern bool gDisableDeactivation;
|
|
|
|
|
2015-08-07 07:13:26 +00:00
|
|
|
int gSharedMemoryKey=-1;
|
|
|
|
|
|
|
|
|
2015-05-02 04:34:27 +00:00
|
|
|
///some quick test variable for the OpenCL examples
|
|
|
|
|
|
|
|
int gPreferredOpenCLDeviceIndex=-1;
|
|
|
|
int gPreferredOpenCLPlatformIndex=-1;
|
2015-05-03 05:33:33 +00:00
|
|
|
int gGpuArraySizeX=15;
|
|
|
|
int gGpuArraySizeY=15;
|
|
|
|
int gGpuArraySizeZ=15;
|
2015-05-02 04:34:27 +00:00
|
|
|
|
2015-04-16 16:55:32 +00:00
|
|
|
//#include <float.h>
|
|
|
|
//unsigned int fp_control_state = _controlfp(_EM_INEXACT, _MCW_EM);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-05-29 22:04:05 +00:00
|
|
|
void deleteDemo()
|
|
|
|
{
|
|
|
|
if (sCurrentDemo)
|
|
|
|
{
|
|
|
|
sCurrentDemo->exitPhysics();
|
|
|
|
s_instancingRenderer->removeAllInstances();
|
|
|
|
delete sCurrentDemo;
|
|
|
|
sCurrentDemo=0;
|
|
|
|
delete s_guiHelper;
|
|
|
|
s_guiHelper = 0;
|
|
|
|
}
|
|
|
|
}
|
2015-04-16 16:55:32 +00:00
|
|
|
|
2015-08-05 01:24:30 +00:00
|
|
|
const char* gPngFileName = 0;
|
2016-07-26 22:36:21 +00:00
|
|
|
int gPngSkipFrames = 0;
|
2015-08-05 01:24:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2015-04-16 16:55:32 +00:00
|
|
|
|
|
|
|
b3KeyboardCallback prevKeyboardCallback = 0;
|
|
|
|
|
|
|
|
void MyKeyboardCallback(int key, int state)
|
|
|
|
{
|
|
|
|
|
2015-05-02 18:40:06 +00:00
|
|
|
//b3Printf("key=%d, state=%d", key, state);
|
2015-04-16 16:55:32 +00:00
|
|
|
bool handled = false;
|
|
|
|
|
2016-07-16 07:55:56 +00:00
|
|
|
if (gui2 && !handled )
|
2015-04-30 20:36:39 +00:00
|
|
|
{
|
2016-07-16 07:55:56 +00:00
|
|
|
handled = gui2->keyboardCallback(key, state);
|
2015-04-30 20:36:39 +00:00
|
|
|
}
|
|
|
|
|
2015-04-16 16:55:32 +00:00
|
|
|
if (!handled && sCurrentDemo)
|
|
|
|
{
|
|
|
|
handled = sCurrentDemo->keyboardCallback(key,state);
|
|
|
|
}
|
|
|
|
|
2015-04-30 20:36:39 +00:00
|
|
|
|
2015-04-16 16:55:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
//checkout: is it desired to ignore keys, if the demo already handles them?
|
|
|
|
//if (handled)
|
|
|
|
// return;
|
|
|
|
|
|
|
|
if (key=='a' && state)
|
|
|
|
{
|
|
|
|
gDebugDrawFlags ^= btIDebugDraw::DBG_DrawAabb;
|
|
|
|
}
|
|
|
|
if (key=='c' && state)
|
|
|
|
{
|
|
|
|
gDebugDrawFlags ^= btIDebugDraw::DBG_DrawContactPoints;
|
|
|
|
}
|
|
|
|
if (key == 'd' && state)
|
|
|
|
{
|
|
|
|
gDebugDrawFlags ^= btIDebugDraw::DBG_NoDeactivation;
|
|
|
|
gDisableDeactivation = ((gDebugDrawFlags & btIDebugDraw::DBG_NoDeactivation) != 0);
|
|
|
|
}
|
2016-08-19 20:58:53 +00:00
|
|
|
if (key == 'k' && state)
|
|
|
|
{
|
|
|
|
gDebugDrawFlags ^= btIDebugDraw::DBG_DrawConstraints;
|
|
|
|
}
|
|
|
|
|
2015-04-16 16:55:32 +00:00
|
|
|
if (key=='l' && state)
|
|
|
|
{
|
|
|
|
gDebugDrawFlags ^= btIDebugDraw::DBG_DrawConstraintLimits;
|
|
|
|
}
|
|
|
|
if (key=='w' && state)
|
|
|
|
{
|
|
|
|
visualWireframe=!visualWireframe;
|
|
|
|
gDebugDrawFlags ^= btIDebugDraw::DBG_DrawWireframe;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (key=='v' && state)
|
|
|
|
{
|
|
|
|
renderVisualGeometry = !renderVisualGeometry;
|
|
|
|
}
|
|
|
|
if (key=='g' && state)
|
|
|
|
{
|
|
|
|
renderGrid = !renderGrid;
|
2015-10-30 17:30:48 +00:00
|
|
|
renderGui = !renderGui;
|
2015-04-16 16:55:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (key=='i' && state)
|
|
|
|
{
|
|
|
|
pauseSimulation = !pauseSimulation;
|
|
|
|
}
|
2016-08-19 17:30:02 +00:00
|
|
|
if (key == 'o' && state)
|
|
|
|
{
|
|
|
|
singleStepSimulation = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-05-06 17:35:14 +00:00
|
|
|
#ifndef NO_OPENGL3
|
2015-04-16 16:55:32 +00:00
|
|
|
if (key=='s' && state)
|
|
|
|
{
|
|
|
|
useShadowMap=!useShadowMap;
|
|
|
|
}
|
2015-05-06 17:35:14 +00:00
|
|
|
#endif
|
2015-08-05 01:24:30 +00:00
|
|
|
if (key==B3G_F1)
|
|
|
|
{
|
|
|
|
static int count=0;
|
|
|
|
if (state)
|
|
|
|
{
|
|
|
|
b3Printf("F1 pressed %d", count++);
|
|
|
|
|
|
|
|
if (gPngFileName)
|
|
|
|
{
|
|
|
|
b3Printf("disable image dump");
|
|
|
|
|
|
|
|
gPngFileName=0;
|
|
|
|
} else
|
|
|
|
{
|
|
|
|
gPngFileName = gAllExamples->getExampleName(sCurrentDemoIndex);
|
|
|
|
b3Printf("enable image dump %s",gPngFileName);
|
|
|
|
|
|
|
|
}
|
|
|
|
} else
|
|
|
|
{
|
|
|
|
b3Printf("F1 released %d",count++);
|
|
|
|
}
|
|
|
|
}
|
2015-04-16 16:55:32 +00:00
|
|
|
if (key==B3G_ESCAPE && s_window)
|
|
|
|
{
|
2015-05-29 22:04:05 +00:00
|
|
|
|
2015-04-16 16:55:32 +00:00
|
|
|
s_window->setRequestExit();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (prevKeyboardCallback)
|
|
|
|
prevKeyboardCallback(key,state);
|
|
|
|
}
|
|
|
|
|
2015-08-05 01:24:30 +00:00
|
|
|
|
2015-04-16 16:55:32 +00:00
|
|
|
b3MouseMoveCallback prevMouseMoveCallback = 0;
|
|
|
|
static void MyMouseMoveCallback( float x, float y)
|
|
|
|
{
|
2016-07-14 16:49:49 +00:00
|
|
|
bool handled = false;
|
2015-04-16 16:55:32 +00:00
|
|
|
if (sCurrentDemo)
|
|
|
|
handled = sCurrentDemo->mouseMoveCallback(x,y);
|
2016-07-16 07:55:56 +00:00
|
|
|
if (!handled && gui2)
|
|
|
|
handled = gui2->mouseMoveCallback(x,y);
|
2015-04-16 16:55:32 +00:00
|
|
|
if (!handled)
|
|
|
|
{
|
|
|
|
if (prevMouseMoveCallback)
|
|
|
|
prevMouseMoveCallback(x,y);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
b3MouseButtonCallback prevMouseButtonCallback = 0;
|
|
|
|
|
|
|
|
static void MyMouseButtonCallback(int button, int state, float x, float y)
|
|
|
|
{
|
|
|
|
bool handled = false;
|
|
|
|
//try picking first
|
|
|
|
if (sCurrentDemo)
|
|
|
|
handled = sCurrentDemo->mouseButtonCallback(button,state,x,y);
|
|
|
|
|
2016-07-16 07:55:56 +00:00
|
|
|
if (!handled && gui2)
|
|
|
|
handled = gui2->mouseButtonCallback(button,state,x,y);
|
2015-04-16 16:55:32 +00:00
|
|
|
|
|
|
|
if (!handled)
|
|
|
|
{
|
|
|
|
if (prevMouseButtonCallback )
|
|
|
|
prevMouseButtonCallback (button,state,x,y);
|
|
|
|
}
|
|
|
|
// b3DefaultMouseButtonCallback(button,state,x,y);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include <string.h>
|
2016-05-13 06:03:12 +00:00
|
|
|
struct FileImporterByExtension
|
|
|
|
{
|
|
|
|
std::string m_extension;
|
|
|
|
CommonExampleInterface::CreateFunc* m_createFunc;
|
|
|
|
};
|
|
|
|
|
|
|
|
static btAlignedObjectArray<FileImporterByExtension> gFileImporterByExtension;
|
|
|
|
|
|
|
|
void OpenGLExampleBrowser::registerFileImporter(const char* extension, CommonExampleInterface::CreateFunc* createFunc)
|
|
|
|
{
|
|
|
|
FileImporterByExtension fi;
|
|
|
|
fi.m_extension = extension;
|
|
|
|
fi.m_createFunc = createFunc;
|
|
|
|
gFileImporterByExtension.push_back(fi);
|
|
|
|
}
|
2015-04-16 16:55:32 +00:00
|
|
|
|
2015-05-01 23:27:09 +00:00
|
|
|
void openFileDemo(const char* filename)
|
2015-04-16 16:55:32 +00:00
|
|
|
{
|
2015-05-01 18:42:14 +00:00
|
|
|
|
2015-04-16 16:55:32 +00:00
|
|
|
if (sCurrentDemo)
|
|
|
|
{
|
2015-05-01 18:42:14 +00:00
|
|
|
sCurrentDemo->exitPhysics();
|
|
|
|
s_instancingRenderer->removeAllInstances();
|
|
|
|
delete sCurrentDemo;
|
|
|
|
sCurrentDemo=0;
|
|
|
|
delete s_guiHelper;
|
|
|
|
s_guiHelper = 0;
|
2015-04-16 16:55:32 +00:00
|
|
|
}
|
2015-05-01 18:42:14 +00:00
|
|
|
|
|
|
|
s_guiHelper= new OpenGLGuiHelper(s_app, sUseOpenGL2);
|
2015-04-16 16:55:32 +00:00
|
|
|
s_parameterInterface->removeAllParameters();
|
|
|
|
|
|
|
|
|
2015-08-06 07:35:03 +00:00
|
|
|
CommonExampleOptions options(s_guiHelper,1);
|
2015-05-01 18:42:14 +00:00
|
|
|
options.m_fileName = filename;
|
2015-05-01 23:27:09 +00:00
|
|
|
char fullPath[1024];
|
|
|
|
sprintf(fullPath, "%s", filename);
|
|
|
|
b3FileUtils::toLower(fullPath);
|
2016-05-13 06:03:12 +00:00
|
|
|
|
|
|
|
for (int i=0;i<gFileImporterByExtension.size();i++)
|
|
|
|
{
|
|
|
|
if (strstr(fullPath, gFileImporterByExtension[i].m_extension.c_str()))
|
|
|
|
{
|
|
|
|
sCurrentDemo = gFileImporterByExtension[i].m_createFunc(options);
|
|
|
|
}
|
|
|
|
}
|
2015-05-01 23:27:09 +00:00
|
|
|
|
2015-05-01 18:42:14 +00:00
|
|
|
|
2015-04-16 16:55:32 +00:00
|
|
|
if (sCurrentDemo)
|
|
|
|
{
|
|
|
|
sCurrentDemo->initPhysics();
|
2015-05-01 18:42:14 +00:00
|
|
|
sCurrentDemo->resetCamera();
|
2015-04-16 16:55:32 +00:00
|
|
|
}
|
|
|
|
|
2015-05-01 18:42:14 +00:00
|
|
|
|
2015-04-16 16:55:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void selectDemo(int demoIndex)
|
|
|
|
{
|
2015-05-01 18:42:14 +00:00
|
|
|
bool resetCamera = (sCurrentDemoIndex != demoIndex);
|
2015-04-16 16:55:32 +00:00
|
|
|
sCurrentDemoIndex = demoIndex;
|
|
|
|
sCurrentHightlighted = demoIndex;
|
|
|
|
int numDemos = gAllExamples->getNumRegisteredExamples();
|
2015-05-01 18:42:14 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2015-04-16 16:55:32 +00:00
|
|
|
if (demoIndex>numDemos)
|
|
|
|
{
|
|
|
|
demoIndex = 0;
|
|
|
|
}
|
2015-05-29 22:04:05 +00:00
|
|
|
deleteDemo();
|
|
|
|
|
2015-04-29 20:33:26 +00:00
|
|
|
CommonExampleInterface::CreateFunc* func = gAllExamples->getExampleCreateFunc(demoIndex);
|
2015-04-16 16:55:32 +00:00
|
|
|
if (func)
|
|
|
|
{
|
2016-07-16 07:55:56 +00:00
|
|
|
if (s_parameterInterface)
|
|
|
|
{
|
|
|
|
s_parameterInterface->removeAllParameters();
|
|
|
|
}
|
2015-04-16 16:55:32 +00:00
|
|
|
int option = gAllExamples->getExampleOption(demoIndex);
|
2015-04-20 22:28:52 +00:00
|
|
|
s_guiHelper= new OpenGLGuiHelper(s_app, sUseOpenGL2);
|
2015-05-02 18:42:43 +00:00
|
|
|
CommonExampleOptions options(s_guiHelper, option);
|
2016-03-10 22:36:46 +00:00
|
|
|
options.m_sharedMem = sSharedMem;
|
2015-05-02 18:42:43 +00:00
|
|
|
sCurrentDemo = (*func)(options);
|
2015-04-16 16:55:32 +00:00
|
|
|
if (sCurrentDemo)
|
|
|
|
{
|
2016-07-16 07:55:56 +00:00
|
|
|
if (gui2)
|
2015-04-16 16:55:32 +00:00
|
|
|
{
|
2016-07-16 07:55:56 +00:00
|
|
|
gui2->setStatusBarMessage("Status: OK", false);
|
2015-04-16 16:55:32 +00:00
|
|
|
}
|
2015-04-28 01:35:07 +00:00
|
|
|
b3Printf("Selected demo: %s",gAllExamples->getExampleName(demoIndex));
|
2016-07-16 07:55:56 +00:00
|
|
|
if (gui2)
|
|
|
|
{
|
|
|
|
gui2->setExampleDescription(gAllExamples->getExampleDescription(demoIndex));
|
|
|
|
}
|
2015-05-01 18:42:14 +00:00
|
|
|
|
2015-04-16 16:55:32 +00:00
|
|
|
sCurrentDemo->initPhysics();
|
2015-05-01 18:42:14 +00:00
|
|
|
if(resetCamera)
|
|
|
|
{
|
|
|
|
sCurrentDemo->resetCamera();
|
|
|
|
}
|
2015-04-16 16:55:32 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
|
2015-08-05 01:24:30 +00:00
|
|
|
static void saveCurrentSettings(int currentEntry,const char* startFileName)
|
2015-04-16 16:55:32 +00:00
|
|
|
{
|
|
|
|
FILE* f = fopen(startFileName,"w");
|
|
|
|
if (f)
|
|
|
|
{
|
2015-08-05 01:24:30 +00:00
|
|
|
fprintf(f,"--start_demo_name=%s\n", gAllExamples->getExampleName(sCurrentDemoIndex));
|
|
|
|
fprintf(f,"--mouse_move_multiplier=%f\n", s_app->getMouseMoveMultiplier());
|
|
|
|
fprintf(f,"--mouse_wheel_multiplier=%f\n", s_app->getMouseWheelMultiplier());
|
|
|
|
float red,green,blue;
|
|
|
|
s_app->getBackgroundColor(&red,&green,&blue);
|
|
|
|
fprintf(f,"--background_color_red= %f\n", red);
|
|
|
|
fprintf(f,"--background_color_green= %f\n", green);
|
|
|
|
fprintf(f,"--background_color_blue= %f\n", blue);
|
2015-08-07 21:18:57 +00:00
|
|
|
fprintf(f,"--fixed_timestep= %f\n", gFixedTimeStep);
|
2015-08-07 23:05:03 +00:00
|
|
|
if (!gAllowRetina)
|
|
|
|
{
|
|
|
|
fprintf(f,"--disable_retina");
|
|
|
|
}
|
2015-08-05 01:24:30 +00:00
|
|
|
|
|
|
|
if (enable_experimental_opencl)
|
|
|
|
{
|
|
|
|
fprintf(f,"--enable_experimental_opencl\n");
|
|
|
|
}
|
|
|
|
if (sUseOpenGL2 )
|
|
|
|
{
|
|
|
|
fprintf(f,"--opengl2\n");
|
|
|
|
}
|
|
|
|
|
2015-04-16 16:55:32 +00:00
|
|
|
fclose(f);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2015-08-05 01:24:30 +00:00
|
|
|
static void loadCurrentSettings(const char* startFileName, b3CommandLineArgs& args)
|
2015-04-16 16:55:32 +00:00
|
|
|
{
|
|
|
|
int currentEntry= 0;
|
|
|
|
FILE* f = fopen(startFileName,"r");
|
|
|
|
if (f)
|
|
|
|
{
|
2015-08-05 01:24:30 +00:00
|
|
|
char oneline[1024];
|
|
|
|
char* argv[] = {0,&oneline[0]};
|
|
|
|
|
|
|
|
while( fgets (oneline, 1024, f)!=NULL )
|
2015-04-16 16:55:32 +00:00
|
|
|
{
|
2015-08-05 01:24:30 +00:00
|
|
|
char *pos;
|
|
|
|
if ((pos=strchr(oneline, '\n')) != NULL)
|
|
|
|
*pos = '\0';
|
|
|
|
args.addArgs(2,argv);
|
2015-04-16 16:55:32 +00:00
|
|
|
}
|
|
|
|
fclose(f);
|
|
|
|
}
|
2015-08-05 01:24:30 +00:00
|
|
|
|
2015-04-16 16:55:32 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
void MyComboBoxCallback(int comboId, const char* item)
|
|
|
|
{
|
|
|
|
//printf("comboId = %d, item = %s\n",comboId, item);
|
|
|
|
if (comboId==DEMO_SELECTION_COMBOBOX)
|
|
|
|
{
|
|
|
|
//find selected item
|
|
|
|
for (int i=0;i<allNames.size();i++)
|
|
|
|
{
|
|
|
|
if (strcmp(item,allNames[i])==0)
|
|
|
|
{
|
|
|
|
selectDemo(i);
|
2015-08-05 01:24:30 +00:00
|
|
|
saveCurrentSettings(sCurrentDemoIndex,startFileName);
|
2015-04-16 16:55:32 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-04-28 01:35:07 +00:00
|
|
|
void MyGuiPrintf(const char* msg)
|
|
|
|
{
|
|
|
|
printf("b3Printf: %s\n",msg);
|
2016-08-19 04:43:43 +00:00
|
|
|
if (!gDisableDemoSelection)
|
2015-04-28 01:35:07 +00:00
|
|
|
{
|
2016-07-16 07:55:56 +00:00
|
|
|
gui2->textOutput(msg);
|
|
|
|
gui2->forceUpdateScrollBars();
|
2015-04-28 01:35:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-04-16 16:55:32 +00:00
|
|
|
|
|
|
|
void MyStatusBarPrintf(const char* msg)
|
|
|
|
{
|
|
|
|
printf("b3Printf: %s\n", msg);
|
2016-08-19 04:43:43 +00:00
|
|
|
if (!gDisableDemoSelection)
|
2015-04-16 16:55:32 +00:00
|
|
|
{
|
|
|
|
bool isLeft = true;
|
2016-07-16 07:55:56 +00:00
|
|
|
gui2->setStatusBarMessage(msg,isLeft);
|
2015-04-16 16:55:32 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-05-03 05:33:33 +00:00
|
|
|
void MyStatusBarError(const char* msg)
|
2015-04-16 16:55:32 +00:00
|
|
|
{
|
|
|
|
printf("Warning: %s\n", msg);
|
2016-08-19 04:43:43 +00:00
|
|
|
if (!gDisableDemoSelection)
|
2015-04-16 16:55:32 +00:00
|
|
|
{
|
|
|
|
bool isLeft = false;
|
2016-07-16 07:55:56 +00:00
|
|
|
gui2->setStatusBarMessage(msg,isLeft);
|
|
|
|
gui2->textOutput(msg);
|
|
|
|
gui2->forceUpdateScrollBars();
|
2015-04-16 16:55:32 +00:00
|
|
|
}
|
2016-08-08 21:23:44 +00:00
|
|
|
btAssert(0);
|
2016-07-25 18:48:44 +00:00
|
|
|
|
2015-04-16 16:55:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
struct MyMenuItemHander :public Gwen::Event::Handler
|
|
|
|
{
|
|
|
|
int m_buttonId;
|
|
|
|
|
|
|
|
MyMenuItemHander( int buttonId)
|
|
|
|
:m_buttonId(buttonId)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void onButtonA(Gwen::Controls::Base* pControl)
|
|
|
|
{
|
|
|
|
//const Gwen::String& name = pControl->GetName();
|
|
|
|
Gwen::Controls::TreeNode* node = (Gwen::Controls::TreeNode*)pControl;
|
|
|
|
// Gwen::Controls::Label* l = node->GetButton();
|
|
|
|
|
|
|
|
Gwen::UnicodeString la = node->GetButton()->GetText();// node->GetButton()->GetName();// GetText();
|
|
|
|
Gwen::String laa = Gwen::Utility::UnicodeToString(la);
|
|
|
|
// const char* ha = laa.c_str();
|
|
|
|
|
|
|
|
//printf("selected %s\n", ha);
|
|
|
|
//int dep = but->IsDepressed();
|
|
|
|
//int tog = but->GetToggleState();
|
|
|
|
// if (m_data->m_toggleButtonCallback)
|
|
|
|
// (*m_data->m_toggleButtonCallback)(m_buttonId, tog);
|
|
|
|
}
|
|
|
|
void onButtonB(Gwen::Controls::Base* pControl)
|
|
|
|
{
|
|
|
|
Gwen::Controls::Label* label = (Gwen::Controls::Label*) pControl;
|
|
|
|
Gwen::UnicodeString la = label->GetText();// node->GetButton()->GetName();// GetText();
|
|
|
|
Gwen::String laa = Gwen::Utility::UnicodeToString(la);
|
|
|
|
//const char* ha = laa.c_str();
|
|
|
|
|
2016-08-13 19:21:18 +00:00
|
|
|
if (!gDisableDemoSelection )
|
|
|
|
{
|
|
|
|
selectDemo(sCurrentHightlighted);
|
|
|
|
saveCurrentSettings(sCurrentDemoIndex, startFileName);
|
|
|
|
}
|
2015-04-16 16:55:32 +00:00
|
|
|
}
|
|
|
|
void onButtonC(Gwen::Controls::Base* pControl)
|
|
|
|
{
|
2015-04-28 01:35:07 +00:00
|
|
|
/*Gwen::Controls::Label* label = (Gwen::Controls::Label*) pControl;
|
|
|
|
Gwen::UnicodeString la = label->GetText();// node->GetButton()->GetName();// GetText();
|
|
|
|
Gwen::String laa = Gwen::Utility::UnicodeToString(la);
|
|
|
|
const char* ha = laa.c_str();
|
2015-04-16 16:55:32 +00:00
|
|
|
|
|
|
|
|
2015-04-28 01:35:07 +00:00
|
|
|
printf("onButtonC ! %s\n", ha);
|
|
|
|
*/
|
2015-04-16 16:55:32 +00:00
|
|
|
}
|
|
|
|
void onButtonD(Gwen::Controls::Base* pControl)
|
|
|
|
{
|
|
|
|
/* Gwen::Controls::Label* label = (Gwen::Controls::Label*) pControl;
|
|
|
|
Gwen::UnicodeString la = label->GetText();// node->GetButton()->GetName();// GetText();
|
|
|
|
Gwen::String laa = Gwen::Utility::UnicodeToString(la);
|
|
|
|
const char* ha = laa.c_str();
|
|
|
|
*/
|
|
|
|
|
|
|
|
// printf("onKeyReturn ! \n");
|
2016-08-13 19:21:18 +00:00
|
|
|
if (!gDisableDemoSelection )
|
|
|
|
{
|
|
|
|
selectDemo(sCurrentHightlighted);
|
|
|
|
saveCurrentSettings(sCurrentDemoIndex, startFileName);
|
|
|
|
}
|
2015-04-16 16:55:32 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void onButtonE(Gwen::Controls::Base* pControl)
|
|
|
|
{
|
|
|
|
// printf("select %d\n",m_buttonId);
|
|
|
|
sCurrentHightlighted = m_buttonId;
|
2016-07-16 07:55:56 +00:00
|
|
|
gui2->setExampleDescription(gAllExamples->getExampleDescription(sCurrentHightlighted));
|
2015-04-16 16:55:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void onButtonF(Gwen::Controls::Base* pControl)
|
|
|
|
{
|
|
|
|
//printf("selection changed!\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
void onButtonG(Gwen::Controls::Base* pControl)
|
|
|
|
{
|
|
|
|
//printf("onButtonG !\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2015-05-29 22:04:05 +00:00
|
|
|
void quitCallback()
|
|
|
|
{
|
|
|
|
|
|
|
|
s_window->setRequestExit();
|
|
|
|
}
|
|
|
|
|
2015-04-16 16:55:32 +00:00
|
|
|
void fileOpenCallback()
|
|
|
|
{
|
|
|
|
|
|
|
|
char filename[1024];
|
|
|
|
int len = s_window->fileOpenDialog(filename,1024);
|
|
|
|
if (len)
|
|
|
|
{
|
|
|
|
//todo(erwincoumans) check if it is actually URDF
|
|
|
|
//printf("file open:%s\n", filename);
|
2015-05-01 23:27:09 +00:00
|
|
|
openFileDemo(filename);
|
2015-04-16 16:55:32 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#define MAX_GRAPH_WINDOWS 5
|
|
|
|
|
|
|
|
struct QuickCanvas : public Common2dCanvasInterface
|
|
|
|
{
|
|
|
|
GL3TexLoader* m_myTexLoader;
|
|
|
|
|
|
|
|
MyGraphWindow* m_gw[MAX_GRAPH_WINDOWS];
|
|
|
|
GraphingTexture* m_gt[MAX_GRAPH_WINDOWS];
|
|
|
|
int m_curNumGraphWindows;
|
2016-08-11 21:55:30 +00:00
|
|
|
int m_curXpos;
|
2015-04-16 16:55:32 +00:00
|
|
|
|
|
|
|
QuickCanvas(GL3TexLoader* myTexLoader)
|
|
|
|
:m_myTexLoader(myTexLoader),
|
2016-08-11 21:55:30 +00:00
|
|
|
m_curNumGraphWindows(0),
|
|
|
|
m_curXpos(0)
|
2015-04-16 16:55:32 +00:00
|
|
|
{
|
|
|
|
for (int i=0;i<MAX_GRAPH_WINDOWS;i++)
|
|
|
|
{
|
|
|
|
m_gw[i] = 0;
|
|
|
|
m_gt[i] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
virtual ~QuickCanvas() {}
|
|
|
|
virtual int createCanvas(const char* canvasName, int width, int height)
|
|
|
|
{
|
|
|
|
if (m_curNumGraphWindows<MAX_GRAPH_WINDOWS)
|
|
|
|
{
|
|
|
|
//find a slot
|
2015-08-10 21:30:00 +00:00
|
|
|
int slot = m_curNumGraphWindows;
|
|
|
|
btAssert(slot<MAX_GRAPH_WINDOWS);
|
|
|
|
if (slot>=MAX_GRAPH_WINDOWS)
|
|
|
|
return 0;//don't crash
|
|
|
|
|
2015-04-16 16:55:32 +00:00
|
|
|
m_curNumGraphWindows++;
|
|
|
|
|
2016-07-16 07:55:56 +00:00
|
|
|
MyGraphInput input(gui2->getInternalData());
|
2015-04-16 16:55:32 +00:00
|
|
|
input.m_width=width;
|
|
|
|
input.m_height=height;
|
2016-08-11 21:55:30 +00:00
|
|
|
input.m_xPos = m_curXpos;//GUI will clamp it to the right//300;
|
|
|
|
m_curXpos+=width+20;
|
2015-08-10 21:30:00 +00:00
|
|
|
input.m_yPos = 10000;//GUI will clamp it to bottom
|
2015-04-16 16:55:32 +00:00
|
|
|
input.m_name=canvasName;
|
|
|
|
input.m_texName = canvasName;
|
|
|
|
m_gt[slot] = new GraphingTexture;
|
|
|
|
m_gt[slot]->create(width,height);
|
|
|
|
int texId = m_gt[slot]->getTextureId();
|
|
|
|
m_myTexLoader->m_hashMap.insert(canvasName, texId);
|
|
|
|
m_gw[slot] = setupTextureWindow(input);
|
|
|
|
|
|
|
|
return slot;
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
virtual void destroyCanvas(int canvasId)
|
|
|
|
{
|
2016-08-11 22:02:00 +00:00
|
|
|
m_curXpos = 0;
|
2015-08-10 21:30:00 +00:00
|
|
|
btAssert(canvasId>=0);
|
2016-07-17 04:29:31 +00:00
|
|
|
delete m_gt[canvasId];
|
|
|
|
m_gt[canvasId] = 0;
|
2015-04-16 16:55:32 +00:00
|
|
|
destroyTextureWindow(m_gw[canvasId]);
|
2016-07-17 04:29:31 +00:00
|
|
|
m_gw[canvasId] = 0;
|
2015-04-16 16:55:32 +00:00
|
|
|
m_curNumGraphWindows--;
|
|
|
|
}
|
|
|
|
virtual void setPixel(int canvasId, int x, int y, unsigned char red, unsigned char green,unsigned char blue, unsigned char alpha)
|
|
|
|
{
|
2015-08-10 21:30:00 +00:00
|
|
|
btAssert(canvasId>=0);
|
|
|
|
btAssert(canvasId<m_curNumGraphWindows);
|
2015-04-16 16:55:32 +00:00
|
|
|
m_gt[canvasId]->setPixel(x,y,red,green,blue,alpha);
|
|
|
|
}
|
2015-07-15 16:07:47 +00:00
|
|
|
|
|
|
|
virtual void getPixel(int canvasId, int x, int y, unsigned char& red, unsigned char& green,unsigned char& blue, unsigned char& alpha)
|
|
|
|
{
|
2015-08-10 21:30:00 +00:00
|
|
|
btAssert(canvasId>=0);
|
|
|
|
btAssert(canvasId<m_curNumGraphWindows);
|
2015-07-15 16:07:47 +00:00
|
|
|
m_gt[canvasId]->getPixel(x,y,red,green,blue,alpha);
|
|
|
|
}
|
|
|
|
|
2015-04-16 16:55:32 +00:00
|
|
|
virtual void refreshImageData(int canvasId)
|
|
|
|
{
|
|
|
|
m_gt[canvasId]->uploadImageData();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
OpenGLExampleBrowser::OpenGLExampleBrowser(class ExampleEntries* examples)
|
|
|
|
{
|
2016-07-16 07:55:56 +00:00
|
|
|
m_internalData = new OpenGLExampleBrowserInternalData;
|
|
|
|
|
2015-04-16 16:55:32 +00:00
|
|
|
gAllExamples = examples;
|
|
|
|
}
|
|
|
|
|
|
|
|
OpenGLExampleBrowser::~OpenGLExampleBrowser()
|
|
|
|
{
|
2016-07-16 07:55:56 +00:00
|
|
|
deleteDemo();
|
|
|
|
for (int i = 0; i < m_internalData->m_nodes.size(); i++)
|
|
|
|
{
|
|
|
|
delete m_internalData->m_nodes[i];
|
|
|
|
}
|
|
|
|
delete m_internalData->m_handler2;
|
|
|
|
for (int i = 0; i < m_internalData->m_handlers.size(); i++)
|
|
|
|
{
|
|
|
|
delete m_internalData->m_handlers[i];
|
|
|
|
}
|
|
|
|
m_internalData->m_handlers.clear();
|
|
|
|
m_internalData->m_nodes.clear();
|
|
|
|
delete s_parameterInterface;
|
|
|
|
s_parameterInterface = 0;
|
|
|
|
delete s_app->m_2dCanvasInterface;
|
|
|
|
s_app->m_2dCanvasInterface = 0;
|
|
|
|
|
|
|
|
m_internalData->m_gui->exit();
|
|
|
|
|
|
|
|
|
|
|
|
delete m_internalData->m_gui;
|
|
|
|
delete m_internalData->m_gwenRenderer;
|
|
|
|
delete m_internalData->m_myTexLoader;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
delete m_internalData->m_app;
|
|
|
|
s_app = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// delete m_internalData->m_profWindow;
|
|
|
|
|
|
|
|
delete m_internalData;
|
|
|
|
|
2016-07-17 04:29:31 +00:00
|
|
|
gFileImporterByExtension.clear();
|
2015-04-16 16:55:32 +00:00
|
|
|
gAllExamples = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "EmptyExample.h"
|
|
|
|
|
|
|
|
bool OpenGLExampleBrowser::init(int argc, char* argv[])
|
|
|
|
{
|
|
|
|
b3CommandLineArgs args(argc,argv);
|
|
|
|
|
2015-08-05 01:24:30 +00:00
|
|
|
loadCurrentSettings(startFileName, args);
|
|
|
|
|
2015-08-07 21:18:57 +00:00
|
|
|
args.GetCmdLineArgument("fixed_timestep",gFixedTimeStep);
|
2016-07-26 22:36:21 +00:00
|
|
|
args.GetCmdLineArgument("png_skip_frames", gPngSkipFrames);
|
2015-05-03 05:33:33 +00:00
|
|
|
///The OpenCL rigid body pipeline is experimental and
|
|
|
|
///most OpenCL drivers and OpenCL compilers have issues with our kernels.
|
|
|
|
///If you have a high-end desktop GPU such as AMD 7970 or better, or NVIDIA GTX 680 with up-to-date drivers
|
|
|
|
///you could give it a try
|
2015-06-30 04:30:44 +00:00
|
|
|
///Note that several old OpenCL physics examples still have to be ported over to this new Example Browser
|
2015-05-03 05:33:33 +00:00
|
|
|
if (args.CheckCmdLineFlag("enable_experimental_opencl"))
|
|
|
|
{
|
2015-08-05 01:24:30 +00:00
|
|
|
enable_experimental_opencl = true;
|
2015-05-03 05:33:33 +00:00
|
|
|
gAllExamples->initOpenCLExampleEntries();
|
|
|
|
}
|
2015-08-07 23:05:03 +00:00
|
|
|
if (args.CheckCmdLineFlag("disable_retina"))
|
|
|
|
{
|
|
|
|
gAllowRetina = false;
|
|
|
|
}
|
|
|
|
|
2015-05-03 05:33:33 +00:00
|
|
|
|
2016-05-04 07:16:53 +00:00
|
|
|
int width = 1024;
|
|
|
|
int height=768;
|
2015-05-06 17:35:14 +00:00
|
|
|
#ifndef NO_OPENGL3
|
2015-04-16 16:55:32 +00:00
|
|
|
SimpleOpenGL3App* simpleApp=0;
|
2015-04-17 06:46:01 +00:00
|
|
|
sUseOpenGL2 =args.CheckCmdLineFlag("opengl2");
|
2015-05-06 17:35:14 +00:00
|
|
|
#else
|
|
|
|
sUseOpenGL2 = true;
|
|
|
|
#endif
|
2015-05-01 18:42:14 +00:00
|
|
|
const char* appTitle = "Bullet Physics ExampleBrowser";
|
|
|
|
#if defined (_DEBUG) || defined (DEBUG)
|
|
|
|
const char* optMode = "Debug build (slow)";
|
|
|
|
#else
|
|
|
|
const char* optMode = "Release build";
|
|
|
|
#endif
|
|
|
|
|
2015-04-17 06:46:01 +00:00
|
|
|
if (sUseOpenGL2 )
|
2015-04-16 16:55:32 +00:00
|
|
|
{
|
2015-05-01 18:42:14 +00:00
|
|
|
char title[1024];
|
2015-05-03 05:33:33 +00:00
|
|
|
sprintf(title,"%s using limited OpenGL2 fallback. %s", appTitle,optMode);
|
2015-05-01 18:42:14 +00:00
|
|
|
s_app = new SimpleOpenGL2App(title,width,height);
|
2015-04-16 16:55:32 +00:00
|
|
|
s_app->m_renderer = new SimpleOpenGL2Renderer(width,height);
|
2015-05-06 17:35:14 +00:00
|
|
|
}
|
2016-07-25 05:22:42 +00:00
|
|
|
|
2015-05-06 17:35:14 +00:00
|
|
|
#ifndef NO_OPENGL3
|
|
|
|
else
|
2015-04-16 16:55:32 +00:00
|
|
|
{
|
2015-05-01 18:42:14 +00:00
|
|
|
char title[1024];
|
|
|
|
sprintf(title,"%s using OpenGL3+. %s", appTitle,optMode);
|
2015-08-07 23:21:33 +00:00
|
|
|
simpleApp = new SimpleOpenGL3App(title,width,height, gAllowRetina);
|
2015-04-16 16:55:32 +00:00
|
|
|
s_app = simpleApp;
|
|
|
|
}
|
2015-05-06 17:35:14 +00:00
|
|
|
#endif
|
2016-07-16 07:55:56 +00:00
|
|
|
m_internalData->m_app = s_app;
|
2015-04-16 16:55:32 +00:00
|
|
|
char* gVideoFileName = 0;
|
|
|
|
args.GetCmdLineArgument("mp4",gVideoFileName);
|
2015-05-06 17:35:14 +00:00
|
|
|
#ifndef NO_OPENGL3
|
2015-04-16 16:55:32 +00:00
|
|
|
if (gVideoFileName)
|
|
|
|
simpleApp->dumpFramesToVideo(gVideoFileName);
|
2015-05-06 17:35:14 +00:00
|
|
|
#endif
|
2015-04-16 16:55:32 +00:00
|
|
|
|
|
|
|
s_instancingRenderer = s_app->m_renderer;
|
2016-05-04 06:46:29 +00:00
|
|
|
s_window = s_app->m_window;
|
|
|
|
|
|
|
|
width = s_window->getWidth();
|
|
|
|
height = s_window->getHeight();
|
|
|
|
|
2015-04-16 16:55:32 +00:00
|
|
|
prevMouseMoveCallback = s_window->getMouseMoveCallback();
|
|
|
|
s_window->setMouseMoveCallback(MyMouseMoveCallback);
|
|
|
|
|
|
|
|
prevMouseButtonCallback = s_window->getMouseButtonCallback();
|
|
|
|
s_window->setMouseButtonCallback(MyMouseButtonCallback);
|
|
|
|
prevKeyboardCallback = s_window->getKeyboardCallback();
|
|
|
|
s_window->setKeyboardCallback(MyKeyboardCallback);
|
|
|
|
|
2015-04-16 22:16:13 +00:00
|
|
|
s_app->m_renderer->getActiveCamera()->setCameraDistance(13);
|
|
|
|
s_app->m_renderer->getActiveCamera()->setCameraPitch(0);
|
|
|
|
s_app->m_renderer->getActiveCamera()->setCameraTargetPosition(0,0,0);
|
2015-04-16 16:55:32 +00:00
|
|
|
|
2015-08-05 01:24:30 +00:00
|
|
|
float mouseMoveMult= s_app->getMouseMoveMultiplier();
|
|
|
|
if (args.GetCmdLineArgument("mouse_move_multiplier", mouseMoveMult))
|
|
|
|
{
|
|
|
|
s_app->setMouseMoveMultiplier(mouseMoveMult);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
float mouseWheelMult= s_app->getMouseWheelMultiplier();
|
|
|
|
if (args.GetCmdLineArgument("mouse_wheel_multiplier",mouseWheelMult))
|
|
|
|
{
|
|
|
|
s_app->setMouseWheelMultiplier(mouseWheelMult);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-08-07 07:13:26 +00:00
|
|
|
args.GetCmdLineArgument("shared_memory_key", gSharedMemoryKey);
|
|
|
|
|
2015-08-05 01:24:30 +00:00
|
|
|
float red,green,blue;
|
|
|
|
s_app->getBackgroundColor(&red,&green,&blue);
|
|
|
|
args.GetCmdLineArgument("background_color_red",red);
|
|
|
|
args.GetCmdLineArgument("background_color_green",green);
|
|
|
|
args.GetCmdLineArgument("background_color_blue",blue);
|
|
|
|
s_app->setBackgroundColor(red,green,blue);
|
|
|
|
|
2015-05-03 05:33:33 +00:00
|
|
|
b3SetCustomWarningMessageFunc(MyGuiPrintf);
|
2015-04-28 01:35:07 +00:00
|
|
|
b3SetCustomPrintfFunc(MyGuiPrintf);
|
2015-05-03 05:33:33 +00:00
|
|
|
b3SetCustomErrorMessageFunc(MyStatusBarError);
|
2015-04-16 16:55:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
assert(glGetError()==GL_NO_ERROR);
|
|
|
|
|
2016-07-16 07:55:56 +00:00
|
|
|
{
|
|
|
|
GL3TexLoader* myTexLoader = new GL3TexLoader;
|
|
|
|
m_internalData->m_myTexLoader = myTexLoader;
|
2015-04-16 16:55:32 +00:00
|
|
|
|
2016-07-16 07:55:56 +00:00
|
|
|
|
|
|
|
if (sUseOpenGL2)
|
|
|
|
{
|
|
|
|
m_internalData->m_gwenRenderer = new Gwen::Renderer::OpenGL_DebugFont();
|
|
|
|
}
|
2015-05-06 17:35:14 +00:00
|
|
|
#ifndef NO_OPENGL3
|
2016-07-16 07:55:56 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
sth_stash* fontstash = simpleApp->getFontStash();
|
|
|
|
m_internalData->m_gwenRenderer = new GwenOpenGL3CoreRenderer(simpleApp->m_primRenderer, fontstash, width, height, s_window->getRetinaScale(), myTexLoader);
|
|
|
|
}
|
2015-05-06 17:35:14 +00:00
|
|
|
#endif
|
2015-04-16 16:55:32 +00:00
|
|
|
|
2016-07-16 07:55:56 +00:00
|
|
|
gui2 = new GwenUserInterface;
|
|
|
|
|
|
|
|
m_internalData->m_gui = gui2;
|
|
|
|
|
|
|
|
m_internalData->m_myTexLoader = myTexLoader;
|
2015-04-16 16:55:32 +00:00
|
|
|
|
|
|
|
|
2016-07-16 07:55:56 +00:00
|
|
|
|
|
|
|
gui2->init(width, height, m_internalData->m_gwenRenderer, s_window->getRetinaScale());
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
//gui = 0;// new GwenUserInterface;
|
2015-04-16 16:55:32 +00:00
|
|
|
|
2016-07-16 07:55:56 +00:00
|
|
|
GL3TexLoader* myTexLoader = m_internalData->m_myTexLoader;
|
|
|
|
// = myTexLoader;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
if (gui2)
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// gui->getInternalData()->m_explorerPage
|
|
|
|
Gwen::Controls::TreeControl* tree = gui2->getInternalData()->m_explorerTreeCtrl;
|
2015-04-16 16:55:32 +00:00
|
|
|
|
|
|
|
|
2016-07-16 07:55:56 +00:00
|
|
|
//gui->getInternalData()->pRenderer->setTextureLoader(myTexLoader);
|
|
|
|
|
|
|
|
|
|
|
|
// s_profWindow= setupProfileWindow(gui2->getInternalData());
|
|
|
|
//m_internalData->m_profWindow = s_profWindow;
|
|
|
|
// profileWindowSetVisible(s_profWindow,false);
|
|
|
|
gui2->setFocus();
|
|
|
|
|
|
|
|
s_parameterInterface = s_app->m_parameterInterface = new GwenParameterInterface(gui2->getInternalData());
|
|
|
|
s_app->m_2dCanvasInterface = new QuickCanvas(myTexLoader);
|
|
|
|
|
2015-04-16 16:55:32 +00:00
|
|
|
|
|
|
|
///add some demos to the gAllExamples
|
|
|
|
|
2016-05-04 06:46:29 +00:00
|
|
|
|
2015-04-16 16:55:32 +00:00
|
|
|
int numDemos = gAllExamples->getNumRegisteredExamples();
|
|
|
|
|
|
|
|
//char nodeText[1024];
|
|
|
|
//int curDemo = 0;
|
2015-08-05 01:24:30 +00:00
|
|
|
int selectedDemo = 0;
|
2015-04-16 16:55:32 +00:00
|
|
|
Gwen::Controls::TreeNode* curNode = tree;
|
2016-07-16 07:55:56 +00:00
|
|
|
m_internalData->m_handler2 = new MyMenuItemHander(-1);
|
2015-04-16 16:55:32 +00:00
|
|
|
|
2015-07-12 21:51:08 +00:00
|
|
|
char* demoNameFromCommandOption = 0;
|
2015-08-05 01:24:30 +00:00
|
|
|
args.GetCmdLineArgument("start_demo_name", demoNameFromCommandOption);
|
2015-07-12 21:51:08 +00:00
|
|
|
if (demoNameFromCommandOption) {
|
|
|
|
selectedDemo = -1;
|
|
|
|
}
|
|
|
|
|
2016-07-16 07:55:56 +00:00
|
|
|
tree->onReturnKeyDown.Add(m_internalData->m_handler2, &MyMenuItemHander::onButtonD);
|
2015-04-16 16:55:32 +00:00
|
|
|
int firstAvailableDemoIndex=-1;
|
|
|
|
Gwen::Controls::TreeNode* firstNode=0;
|
|
|
|
|
|
|
|
for (int d = 0; d<numDemos; d++)
|
|
|
|
{
|
|
|
|
// sprintf(nodeText, "Node %d", i);
|
|
|
|
Gwen::UnicodeString nodeUText = Gwen::Utility::StringToUnicode(gAllExamples->getExampleName(d));
|
|
|
|
if (gAllExamples->getExampleCreateFunc(d))//was test for gAllExamples[d].m_menuLevel==1
|
|
|
|
{
|
|
|
|
Gwen::Controls::TreeNode* pNode = curNode->AddNode(nodeUText);
|
|
|
|
|
|
|
|
if (firstAvailableDemoIndex<0)
|
|
|
|
{
|
|
|
|
firstAvailableDemoIndex = d;
|
|
|
|
firstNode = pNode;
|
|
|
|
}
|
2015-05-02 18:40:06 +00:00
|
|
|
|
2015-04-16 16:55:32 +00:00
|
|
|
if (d == selectedDemo)
|
|
|
|
{
|
2015-05-02 18:40:06 +00:00
|
|
|
firstAvailableDemoIndex = d;
|
|
|
|
firstNode = pNode;
|
|
|
|
//pNode->SetSelected(true);
|
|
|
|
//tree->ExpandAll();
|
|
|
|
// tree->ForceUpdateScrollBars();
|
|
|
|
//tree->OnKeyLeft(true);
|
|
|
|
// tree->OnKeyRight(true);
|
|
|
|
|
|
|
|
|
|
|
|
//tree->ExpandAll();
|
|
|
|
|
|
|
|
// selectDemo(d);
|
2015-04-16 16:55:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
}
|
2015-08-05 01:24:30 +00:00
|
|
|
|
|
|
|
if (demoNameFromCommandOption )
|
|
|
|
{
|
|
|
|
const char* demoName = gAllExamples->getExampleName(d);
|
|
|
|
int res = strcmp(demoName, demoNameFromCommandOption);
|
|
|
|
if (res==0)
|
|
|
|
{
|
|
|
|
firstAvailableDemoIndex = d;
|
|
|
|
firstNode = pNode;
|
|
|
|
}
|
2015-07-12 21:51:08 +00:00
|
|
|
}
|
2015-05-02 18:40:06 +00:00
|
|
|
|
2016-07-16 07:55:56 +00:00
|
|
|
#if 1
|
2015-04-16 16:55:32 +00:00
|
|
|
MyMenuItemHander* handler = new MyMenuItemHander(d);
|
2016-07-16 07:55:56 +00:00
|
|
|
m_internalData->m_handlers.push_back(handler);
|
|
|
|
|
2015-04-16 16:55:32 +00:00
|
|
|
pNode->onNamePress.Add(handler, &MyMenuItemHander::onButtonA);
|
|
|
|
pNode->GetButton()->onDoubleClick.Add(handler, &MyMenuItemHander::onButtonB);
|
|
|
|
pNode->GetButton()->onDown.Add(handler, &MyMenuItemHander::onButtonC);
|
|
|
|
pNode->onSelect.Add(handler, &MyMenuItemHander::onButtonE);
|
|
|
|
pNode->onReturnKeyDown.Add(handler, &MyMenuItemHander::onButtonG);
|
|
|
|
pNode->onSelectChange.Add(handler, &MyMenuItemHander::onButtonF);
|
2016-07-16 07:55:56 +00:00
|
|
|
|
|
|
|
#endif
|
2015-04-16 16:55:32 +00:00
|
|
|
// pNode->onKeyReturn.Add(handler, &MyMenuItemHander::onButtonD);
|
|
|
|
// pNode->GetButton()->onKeyboardReturn.Add(handler, &MyMenuItemHander::onButtonD);
|
|
|
|
// pNode->onNamePress.Add(handler, &MyMenuItemHander::onButtonD);
|
|
|
|
// pNode->onKeyboardPressed.Add(handler, &MyMenuItemHander::onButtonD);
|
|
|
|
// pNode->OnKeyPress
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
curNode = tree->AddNode(nodeUText);
|
2016-07-16 07:55:56 +00:00
|
|
|
m_internalData->m_nodes.push_back(curNode);
|
2015-04-16 16:55:32 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sCurrentDemo==0)
|
|
|
|
{
|
|
|
|
if (firstAvailableDemoIndex>=0)
|
|
|
|
{
|
|
|
|
firstNode->SetSelected(true);
|
2015-05-02 18:40:06 +00:00
|
|
|
while (firstNode != tree)
|
|
|
|
{
|
|
|
|
firstNode->ExpandAll();
|
|
|
|
firstNode = (Gwen::Controls::TreeNode*)firstNode->GetParent();
|
|
|
|
}
|
|
|
|
|
2015-04-16 16:55:32 +00:00
|
|
|
selectDemo(firstAvailableDemoIndex);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2016-07-16 07:55:56 +00:00
|
|
|
free(demoNameFromCommandOption);
|
|
|
|
demoNameFromCommandOption = 0;
|
|
|
|
|
2015-04-16 16:55:32 +00:00
|
|
|
btAssert(sCurrentDemo!=0);
|
|
|
|
if (sCurrentDemo==0)
|
|
|
|
{
|
|
|
|
printf("Error, no demo/example\n");
|
|
|
|
exit(0);
|
|
|
|
}
|
|
|
|
|
2016-07-16 07:55:56 +00:00
|
|
|
gui2->registerFileOpenCallback(fileOpenCallback);
|
|
|
|
gui2->registerQuitCallback(quitCallback);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-04-16 16:55:32 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-04-29 20:33:26 +00:00
|
|
|
CommonExampleInterface* OpenGLExampleBrowser::getCurrentExample()
|
2015-04-16 16:55:32 +00:00
|
|
|
{
|
|
|
|
btAssert(sCurrentDemo);
|
|
|
|
return sCurrentDemo;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool OpenGLExampleBrowser::requestedExit()
|
|
|
|
{
|
|
|
|
return s_window->requestedExit();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OpenGLExampleBrowser::update(float deltaTime)
|
|
|
|
{
|
|
|
|
|
2015-08-05 05:03:53 +00:00
|
|
|
assert(glGetError()==GL_NO_ERROR);
|
2015-04-16 16:55:32 +00:00
|
|
|
s_instancingRenderer->init();
|
|
|
|
DrawGridData dg;
|
|
|
|
dg.upAxis = s_app->getUpAxis();
|
|
|
|
|
|
|
|
{
|
2015-04-16 22:16:13 +00:00
|
|
|
BT_PROFILE("Update Camera and Light");
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-04-16 16:55:32 +00:00
|
|
|
s_instancingRenderer->updateCamera(dg.upAxis);
|
|
|
|
}
|
|
|
|
|
2016-07-13 01:16:13 +00:00
|
|
|
|
2015-04-16 16:55:32 +00:00
|
|
|
static int frameCount = 0;
|
|
|
|
frameCount++;
|
|
|
|
|
|
|
|
if (0)
|
|
|
|
{
|
|
|
|
BT_PROFILE("Draw frame counter");
|
|
|
|
char bla[1024];
|
|
|
|
sprintf(bla,"Frame %d", frameCount);
|
|
|
|
s_app->drawText(bla,10,10);
|
|
|
|
}
|
|
|
|
|
2016-08-17 17:18:33 +00:00
|
|
|
if (gPngFileName)
|
|
|
|
{
|
|
|
|
|
|
|
|
static int skip = 0;
|
|
|
|
skip--;
|
|
|
|
if (skip<0)
|
|
|
|
{
|
|
|
|
skip=gPngSkipFrames;
|
|
|
|
//printf("gPngFileName=%s\n",gPngFileName);
|
|
|
|
static int s_frameCount = 100;
|
|
|
|
|
|
|
|
sprintf(staticPngFileName,"%s%d.png",gPngFileName,s_frameCount++);
|
|
|
|
//b3Printf("Made screenshot %s",staticPngFileName);
|
|
|
|
s_app->dumpNextFrameToPng(staticPngFileName);
|
|
|
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-04-28 01:35:07 +00:00
|
|
|
|
2015-04-16 16:55:32 +00:00
|
|
|
if (sCurrentDemo)
|
|
|
|
{
|
2016-08-19 17:30:02 +00:00
|
|
|
if (!pauseSimulation || singleStepSimulation)
|
2015-04-16 16:55:32 +00:00
|
|
|
{
|
2016-08-19 17:30:02 +00:00
|
|
|
singleStepSimulation = false;
|
2015-04-16 16:55:32 +00:00
|
|
|
//printf("---------------------------------------------------\n");
|
|
|
|
//printf("Framecount = %d\n",frameCount);
|
2016-08-19 17:30:02 +00:00
|
|
|
|
2015-08-07 21:18:57 +00:00
|
|
|
if (gFixedTimeStep>0)
|
|
|
|
{
|
|
|
|
sCurrentDemo->stepSimulation(gFixedTimeStep);
|
|
|
|
} else
|
|
|
|
{
|
|
|
|
sCurrentDemo->stepSimulation(deltaTime);//1./60.f);
|
|
|
|
}
|
2015-04-16 16:55:32 +00:00
|
|
|
}
|
|
|
|
|
2016-07-13 01:16:13 +00:00
|
|
|
if (renderGrid)
|
|
|
|
{
|
|
|
|
BT_PROFILE("Draw Grid");
|
|
|
|
glPolygonOffset(3.0, 3);
|
|
|
|
glEnable(GL_POLYGON_OFFSET_FILL);
|
|
|
|
s_app->drawGrid(dg);
|
|
|
|
|
|
|
|
}
|
2015-05-02 18:40:06 +00:00
|
|
|
if (renderVisualGeometry && ((gDebugDrawFlags&btIDebugDraw::DBG_DrawWireframe)==0))
|
2015-04-16 16:55:32 +00:00
|
|
|
{
|
|
|
|
if (visualWireframe)
|
|
|
|
{
|
|
|
|
glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
|
|
|
|
}
|
|
|
|
BT_PROFILE("Render Scene");
|
|
|
|
sCurrentDemo->renderScene();
|
|
|
|
}
|
|
|
|
{
|
2015-05-02 18:40:06 +00:00
|
|
|
|
2015-04-16 16:55:32 +00:00
|
|
|
glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
|
|
|
|
sCurrentDemo->physicsDebugDraw(gDebugDrawFlags);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-08-17 17:18:33 +00:00
|
|
|
|
2016-07-26 22:36:21 +00:00
|
|
|
|
2015-05-01 18:42:14 +00:00
|
|
|
{
|
|
|
|
|
2016-07-16 07:55:56 +00:00
|
|
|
if (gui2 && s_guiHelper && s_guiHelper->getRenderInterface() && s_guiHelper->getRenderInterface()->getActiveCamera())
|
2015-05-01 18:42:14 +00:00
|
|
|
{
|
|
|
|
char msg[1024];
|
|
|
|
float camDist = s_guiHelper->getRenderInterface()->getActiveCamera()->getCameraDistance();
|
|
|
|
float pitch = s_guiHelper->getRenderInterface()->getActiveCamera()->getCameraPitch();
|
|
|
|
float yaw = s_guiHelper->getRenderInterface()->getActiveCamera()->getCameraYaw();
|
|
|
|
float camTarget[3];
|
|
|
|
s_guiHelper->getRenderInterface()->getActiveCamera()->getCameraTargetPosition(camTarget);
|
|
|
|
sprintf(msg,"dist=%f, pitch=%f, yaw=%f,target=%f,%f,%f", camDist,pitch,yaw,camTarget[0],camTarget[1],camTarget[2]);
|
2016-07-16 07:55:56 +00:00
|
|
|
gui2->setStatusBarMessage(msg, true);
|
2015-05-01 18:42:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2015-04-16 16:55:32 +00:00
|
|
|
static int toggle = 1;
|
2015-10-30 17:30:48 +00:00
|
|
|
if (renderGui)
|
2015-04-16 16:55:32 +00:00
|
|
|
{
|
2016-07-16 07:55:56 +00:00
|
|
|
// if (!pauseSimulation)
|
|
|
|
// processProfileData(s_profWindow,false);
|
2015-04-16 16:55:32 +00:00
|
|
|
|
2016-07-16 07:55:56 +00:00
|
|
|
if (sUseOpenGL2)
|
2015-04-28 01:35:07 +00:00
|
|
|
{
|
2016-07-16 07:55:56 +00:00
|
|
|
|
|
|
|
saveOpenGLState(s_instancingRenderer->getScreenWidth(), s_instancingRenderer->getScreenHeight());
|
|
|
|
}
|
|
|
|
BT_PROFILE("Draw Gwen GUI");
|
|
|
|
if (m_internalData->m_gui)
|
|
|
|
{
|
|
|
|
m_internalData->m_gui->draw(s_instancingRenderer->getScreenWidth(), s_instancingRenderer->getScreenHeight());
|
2015-04-28 01:35:07 +00:00
|
|
|
}
|
2016-07-16 07:55:56 +00:00
|
|
|
if (gui2)
|
|
|
|
{
|
|
|
|
gui2->draw(s_instancingRenderer->getScreenWidth(), s_instancingRenderer->getScreenHeight());
|
|
|
|
}
|
|
|
|
|
2015-04-28 01:35:07 +00:00
|
|
|
if (sUseOpenGL2)
|
|
|
|
{
|
|
|
|
restoreOpenGLState();
|
2015-04-16 16:55:32 +00:00
|
|
|
}
|
2015-04-28 01:35:07 +00:00
|
|
|
|
2015-04-16 16:55:32 +00:00
|
|
|
}
|
2015-08-05 01:24:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-04-16 16:55:32 +00:00
|
|
|
toggle=1-toggle;
|
|
|
|
{
|
|
|
|
BT_PROFILE("Sync Parameters");
|
2016-07-16 07:55:56 +00:00
|
|
|
if (s_parameterInterface)
|
|
|
|
{
|
|
|
|
s_parameterInterface->syncParameters();
|
|
|
|
}
|
2015-04-16 16:55:32 +00:00
|
|
|
}
|
|
|
|
{
|
|
|
|
BT_PROFILE("Swap Buffers");
|
|
|
|
s_app->swapBuffer();
|
|
|
|
}
|
2015-04-28 01:35:07 +00:00
|
|
|
|
2016-07-16 07:55:56 +00:00
|
|
|
if (gui2)
|
|
|
|
{
|
|
|
|
gui2->forceUpdateScrollBars();
|
|
|
|
}
|
2015-04-16 16:55:32 +00:00
|
|
|
|
2015-04-16 22:52:30 +00:00
|
|
|
}
|
2016-03-10 22:36:46 +00:00
|
|
|
|
|
|
|
void OpenGLExampleBrowser::setSharedMemoryInterface(class SharedMemoryInterface* sharedMem)
|
|
|
|
{
|
2016-08-13 19:21:18 +00:00
|
|
|
gDisableDemoSelection = true;
|
2016-03-10 22:36:46 +00:00
|
|
|
sSharedMem = sharedMem;
|
|
|
|
}
|