main.cpp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #include "OpenGLWindow/SimpleOpenGL3App.h"
  2. #include "Bullet3Common/b3Vector3.h"
  3. #include "Bullet3Common/b3CommandLineArgs.h"
  4. #include "assert.h"
  5. #include <stdio.h>
  6. #include "OpenGLWindow/OpenGLInclude.h"
  7. char* gVideoFileName = 0;
  8. char* gPngFileName = 0;
  9. int main(int argc, char* argv[])
  10. {
  11. b3CommandLineArgs myArgs(argc,argv);
  12. SimpleOpenGL3App* app = new SimpleOpenGL3App("SimpleOpenGL3App",1024,768,true);
  13. app->m_instancingRenderer->getActiveCamera()->setCameraDistance(13);
  14. app->m_instancingRenderer->getActiveCamera()->setCameraPitch(0);
  15. app->m_instancingRenderer->getActiveCamera()->setCameraTargetPosition(0,0,0);
  16. assert(glGetError()==GL_NO_ERROR);
  17. myArgs.GetCmdLineArgument("mp4_file",gVideoFileName);
  18. if (gVideoFileName)
  19. app->dumpFramesToVideo(gVideoFileName);
  20. myArgs.GetCmdLineArgument("png_file",gPngFileName);
  21. char fileName[1024];
  22. do
  23. {
  24. static int frameCount = 0;
  25. frameCount++;
  26. if (gPngFileName)
  27. {
  28. printf("gPngFileName=%s\n",gPngFileName);
  29. sprintf(fileName,"%s%d.png",gPngFileName,frameCount++);
  30. app->dumpNextFrameToPng(fileName);
  31. }
  32. assert(glGetError()==GL_NO_ERROR);
  33. app->m_instancingRenderer->init();
  34. app->m_instancingRenderer->updateCamera();
  35. app->drawGrid();
  36. char bla[1024];
  37. sprintf(bla,"Simple test frame %d", frameCount);
  38. app->drawText(bla,10,10);
  39. app->swapBuffer();
  40. } while (!app->m_window->requestedExit());
  41. delete app;
  42. return 0;
  43. }