mirror of
https://github.com/bulletphysics/bullet3
synced 2024-12-12 12:50:08 +00:00
testing ImGUI
This commit is contained in:
parent
a43f3b026a
commit
f73b54e4ab
@ -266,9 +266,10 @@ end
|
||||
if _OPTIONS["enable_pybullet"] then
|
||||
include "../examples/pybullet"
|
||||
end
|
||||
include "../examples/SimpleOpenGL3"
|
||||
|
||||
if _OPTIONS["standalone-examples"] then
|
||||
include "../examples/SimpleOpenGL3"
|
||||
|
||||
include "../examples/TinyRenderer"
|
||||
include "../examples/BasicDemo"
|
||||
include "../examples/InverseDynamics"
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "GLInstanceGraphicsShape.h"
|
||||
#include "stdlib.h"
|
||||
#include "TwFonts.h"
|
||||
#include "SimpleOpenGL2Renderer.h"
|
||||
#ifdef __APPLE__
|
||||
#include "MacOpenGLWindow.h"
|
||||
#else
|
||||
@ -177,6 +178,8 @@ SimpleOpenGL2App::SimpleOpenGL2App(const char* title, int width, int height)
|
||||
m_window->setWheelCallback(Simple2WheelCallback);
|
||||
m_window->setResizeCallback(Simple2ResizeCallback);
|
||||
|
||||
m_renderer = new SimpleOpenGL2Renderer(width,height);
|
||||
|
||||
}
|
||||
|
||||
SimpleOpenGL2App::~SimpleOpenGL2App()
|
||||
|
@ -16,7 +16,7 @@ struct SimpleOpenGL3App : public CommonGraphicsApp
|
||||
class GLInstancingRenderer* m_instancingRenderer;
|
||||
virtual void setBackgroundColor(float red, float green, float blue);
|
||||
|
||||
SimpleOpenGL3App(const char* title, int width,int height, bool allowRetina);
|
||||
SimpleOpenGL3App(const char* title, int width,int height, bool allowRetina=true);
|
||||
virtual ~SimpleOpenGL3App();
|
||||
|
||||
virtual int registerCubeShape(float halfExtentsX=1.f,float halfExtentsY=1.f, float halfExtentsZ = 1.f, int textureIndex = -1, float textureScaling = 1);
|
||||
|
@ -1,8 +1,15 @@
|
||||
|
||||
|
||||
//#define USE_OPENGL2
|
||||
#ifdef USE_OPENGL2
|
||||
#include "OpenGLWindow/SimpleOpenGL2App.h"
|
||||
typedef SimpleOpenGL2App SimpleOpenGLApp ;
|
||||
|
||||
#else
|
||||
#include "OpenGLWindow/SimpleOpenGL3App.h"
|
||||
typedef SimpleOpenGL3App SimpleOpenGLApp ;
|
||||
|
||||
#endif //USE_OPENGL2
|
||||
|
||||
#include "Bullet3Common/b3Quaternion.h"
|
||||
#include "Bullet3Common/b3CommandLineArgs.h"
|
||||
@ -23,7 +30,7 @@ static b3KeyboardCallback sOldKeyboardCB = 0;
|
||||
|
||||
float gWidth = 1024;
|
||||
float gHeight = 768;
|
||||
SimpleOpenGL3App* app = 0;
|
||||
SimpleOpenGLApp* app = 0;
|
||||
float gMouseX = 0;
|
||||
float gMouseY = 0;
|
||||
float g_MouseWheel = 0.0f;
|
||||
@ -246,11 +253,12 @@ int main(int argc, char* argv[])
|
||||
b3CommandLineArgs myArgs(argc, argv);
|
||||
|
||||
|
||||
app = new SimpleOpenGL3App("SimpleOpenGL3App", gWidth, gHeight, true);
|
||||
app = new SimpleOpenGLApp("SimpleOpenGLApp", gWidth, gHeight);
|
||||
|
||||
app->m_renderer->getActiveCamera()->setCameraDistance(13);
|
||||
app->m_renderer->getActiveCamera()->setCameraPitch(0);
|
||||
app->m_renderer->getActiveCamera()->setCameraTargetPosition(0, 0, 0);
|
||||
|
||||
app->m_instancingRenderer->getActiveCamera()->setCameraDistance(13);
|
||||
app->m_instancingRenderer->getActiveCamera()->setCameraPitch(0);
|
||||
app->m_instancingRenderer->getActiveCamera()->setCameraTargetPosition(0, 0, 0);
|
||||
sOldKeyboardCB = app->m_window->getKeyboardCallback();
|
||||
app->m_window->setKeyboardCallback(MyKeyboardCallback);
|
||||
sOldMouseMoveCB = app->m_window->getMouseMoveCallback();
|
||||
@ -320,19 +328,19 @@ int main(int argc, char* argv[])
|
||||
app->m_renderer->activateTexture(textureHandle);
|
||||
app->m_renderer->updateTexture(textureHandle, image);
|
||||
|
||||
float color[4] = { 255, 1, 1, 1 };
|
||||
app->m_primRenderer->drawTexturedRect(100, 200, gWidth / 2 - 50, gHeight / 2 - 50, color, 0, 0, 1, 1, true);
|
||||
//float color[4] = { 255, 1, 1, 1 };
|
||||
//app->m_primRenderer->drawTexturedRect(100, 200, gWidth / 2 - 50, gHeight / 2 - 50, color, 0, 0, 1, 1, true);
|
||||
|
||||
|
||||
app->m_instancingRenderer->init();
|
||||
app->m_instancingRenderer->updateCamera();
|
||||
app->m_renderer->init();
|
||||
app->m_renderer->updateCamera(1);
|
||||
|
||||
app->m_renderer->renderScene();
|
||||
app->drawGrid();
|
||||
char bla[1024];
|
||||
sprintf(bla, "Simple test frame %d", frameCount);
|
||||
|
||||
app->drawText(bla, 10, 10);
|
||||
//app->drawText(bla, 10, 10);
|
||||
|
||||
#ifdef B3_USE_IMGUI
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user