File: main.cpp

package info (click to toggle)
bullet 2.83.7%2Bdfsg-5
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 48,772 kB
  • sloc: cpp: 355,312; lisp: 12,087; ansic: 11,969; python: 644; makefile: 116; xml: 27
file content (57 lines) | stat: -rw-r--r-- 1,480 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include "OpenGLWindow/SimpleOpenGL3App.h"
#include "Bullet3Common/b3Vector3.h"
#include "Bullet3Common/b3CommandLineArgs.h"
#include "assert.h"
#include <stdio.h>
#include "OpenGLWindow/OpenGLInclude.h"

char* gVideoFileName = 0;
char* gPngFileName = 0;

int main(int argc, char* argv[])
{
    b3CommandLineArgs myArgs(argc,argv);


	SimpleOpenGL3App* app = new SimpleOpenGL3App("SimpleOpenGL3App",1024,768,true);
	app->m_instancingRenderer->getActiveCamera()->setCameraDistance(13);
	app->m_instancingRenderer->getActiveCamera()->setCameraPitch(0);
	app->m_instancingRenderer->getActiveCamera()->setCameraTargetPosition(0,0,0);

    assert(glGetError()==GL_NO_ERROR);

    myArgs.GetCmdLineArgument("mp4_file",gVideoFileName);
    if (gVideoFileName)
        app->dumpFramesToVideo(gVideoFileName);

    myArgs.GetCmdLineArgument("png_file",gPngFileName);
    char fileName[1024];

	do
	{
	    static int frameCount = 0;
		frameCount++;
		if (gPngFileName)
        {
            printf("gPngFileName=%s\n",gPngFileName);

            sprintf(fileName,"%s%d.png",gPngFileName,frameCount++);
            app->dumpNextFrameToPng(fileName);
        }

		assert(glGetError()==GL_NO_ERROR);
		app->m_instancingRenderer->init();
		app->m_instancingRenderer->updateCamera();

		app->drawGrid();
		char bla[1024];
		sprintf(bla,"Simple test frame %d", frameCount);

		app->drawText(bla,10,10);
		app->swapBuffer();
	} while (!app->m_window->requestedExit());


	delete app;
	return 0;
}