Seeing Output of Program

Post Reply
Fudz4
Posts: 6
Joined: Tue Apr 05, 2016 2:27 pm

Seeing Output of Program

Post by Fudz4 »

Hey, I am a complete noob to Bullet, Im currently made a OpenGL program where spheres move in different directions and now I just need to provide an object collision system.

In order for me to learn how this works I thought I would try the tutorial in this faq, the BulletTestApp program, anyway I used CMake to get the libraries and everything and followed all instructions, and it builded successfully, when it debugged I got the following.

'BulletTestApp.exe' (Win32): Loaded 'C:\Users\Fads\Documents\tutorial\BulletTestApp\Debug\BulletTestApp.exe'. Symbols loaded.
'BulletTestApp.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ntdll.dll'. Symbols loaded.
'BulletTestApp.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel32.dll'. Symbols loaded.
'BulletTestApp.exe' (Win32): Loaded 'C:\Windows\SysWOW64\KernelBase.dll'. Symbols loaded.
'BulletTestApp.exe' (Win32): Loaded 'C:\Windows\SysWOW64\advapi32.dll'. Symbols loaded.
'BulletTestApp.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcrt.dll'. Symbols loaded.
'BulletTestApp.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sechost.dll'. Symbols loaded.
'BulletTestApp.exe' (Win32): Loaded 'C:\Windows\SysWOW64\rpcrt4.dll'. Symbols loaded.
'BulletTestApp.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sspicli.dll'. Symbols loaded.
'BulletTestApp.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cryptbase.dll'. Symbols loaded.
'BulletTestApp.exe' (Win32): Loaded 'C:\Windows\SysWOW64\bcryptprimitives.dll'. Symbols loaded.
INTEL_GT_DEBUGGER: (196256) Received a program load complete event for pid: 9200
INTEL_GT_DEBUGGER: (196905) Received a process destroy event for pid: 9200
'BulletTestApp.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel.appcore.dll'. Symbols loaded.
The thread 0x2008 has exited with code 0 (0x0).
The thread 0x1df0 has exited with code 0 (0x0).
The program '[9200] BulletTestApp.exe' has exited with code 0 (0x0).

From what I understand, the program executed but I didnt see anything? Can someone explain to me how this works? Thanks.

I apologize in advance if I posted in the wrong area.
Basroil
Posts: 463
Joined: Fri Nov 30, 2012 4:50 am

Re: Seeing Output of Program

Post by Basroil »

Sounds like it worked properly. Try running the example browser next to see if that's closer to what you expected to see.
Fudz4
Posts: 6
Joined: Tue Apr 05, 2016 2:27 pm

Re: Seeing Output of Program

Post by Fudz4 »

Basroil wrote:Sounds like it worked properly. Try running the example browser next to see if that's closer to what you expected to see.
Hi, ok so bear with me :) I couldnt find the browser example you were talking about, but I tried the Hello World walkthrough, I set up libraries and here is my code:

Code: Select all

// HelloWorld.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <iostream>
#include <btBulletDynamicsCommon.h>



int main(void)
{

	btBroadphaseInterface* broadphase = new btDbvtBroadphase();

	btDefaultCollisionConfiguration* collisionConfiguration = new btDefaultCollisionConfiguration();
	btCollisionDispatcher* dispatcher = new btCollisionDispatcher(collisionConfiguration);

	btSequentialImpulseConstraintSolver* solver = new btSequentialImpulseConstraintSolver;

	btDiscreteDynamicsWorld* dynamicsWorld = new btDiscreteDynamicsWorld(dispatcher, broadphase, solver, collisionConfiguration);

	dynamicsWorld->setGravity(btVector3(0, -10, 0));


	btCollisionShape* groundShape = new btStaticPlaneShape(btVector3(0, 1, 0), 1);

	btCollisionShape* fallShape = new btSphereShape(1);


	btDefaultMotionState* groundMotionState = new btDefaultMotionState(btTransform(btQuaternion(0, 0, 0, 1), btVector3(0, -1, 0)));
	btRigidBody::btRigidBodyConstructionInfo
		groundRigidBodyCI(0, groundMotionState, groundShape, btVector3(0, 0, 0));
	btRigidBody* groundRigidBody = new btRigidBody(groundRigidBodyCI);
	dynamicsWorld->addRigidBody(groundRigidBody);


	btDefaultMotionState* fallMotionState =
		new btDefaultMotionState(btTransform(btQuaternion(0, 0, 0, 1), btVector3(0, 50, 0)));
	btScalar mass = 1;
	btVector3 fallInertia(0, 0, 0);
	fallShape->calculateLocalInertia(mass, fallInertia);
	btRigidBody::btRigidBodyConstructionInfo fallRigidBodyCI(mass, fallMotionState, fallShape, fallInertia);
	btRigidBody* fallRigidBody = new btRigidBody(fallRigidBodyCI);
	dynamicsWorld->addRigidBody(fallRigidBody);


	for (int i = 0; i < 300; i++) {
		dynamicsWorld->stepSimulation(1 / 60.f, 10);

		btTransform trans;
		fallRigidBody->getMotionState()->getWorldTransform(trans);

		std::cout << "sphere height: " << trans.getOrigin().getY() << std::endl;
	}

	dynamicsWorld->removeRigidBody(fallRigidBody);
	delete fallRigidBody->getMotionState();
	delete fallRigidBody;

	dynamicsWorld->removeRigidBody(groundRigidBody);
	delete groundRigidBody->getMotionState();
	delete groundRigidBody;


	delete fallShape;

	delete groundShape;


	delete dynamicsWorld;
	delete solver;
	delete collisionConfiguration;
	delete dispatcher;
	delete broadphase;

	return 0;
}
And I build it and debug it and I get the following:

'HelloWorld.exe' (Win32): Loaded 'C:\Users\Fads\Documents\Visual Studio 2015\Projects\BulletHelloWorld\HelloWorld\Debug\HelloWorld.exe'. Symbols loaded.
'HelloWorld.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ntdll.dll'. Symbols loaded.
'HelloWorld.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel32.dll'. Symbols loaded.
'HelloWorld.exe' (Win32): Loaded 'C:\Windows\SysWOW64\KernelBase.dll'. Symbols loaded.
'HelloWorld.exe' (Win32): Loaded 'C:\Windows\SysWOW64\apphelp.dll'. Symbols loaded.
'HelloWorld.exe' (Win32): Loaded 'C:\Windows\SysWOW64\vcruntime140d.dll'. Symbols loaded.
'HelloWorld.exe' (Win32): Loaded 'C:\Windows\SysWOW64\advapi32.dll'. Symbols loaded.
'HelloWorld.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcrt.dll'. Symbols loaded.
'HelloWorld.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcp140d.dll'. Symbols loaded.
'HelloWorld.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sechost.dll'. Symbols loaded.
'HelloWorld.exe' (Win32): Loaded 'C:\Windows\SysWOW64\rpcrt4.dll'. Symbols loaded.
INTEL_GT_DEBUGGER: (1256485) Received a program load complete event for pid: 1352
'HelloWorld.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ucrtbased.dll'. Cannot find or open the PDB file.
'HelloWorld.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sspicli.dll'. Symbols loaded.
'HelloWorld.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cryptbase.dll'. Symbols loaded.
'HelloWorld.exe' (Win32): Loaded 'C:\Windows\SysWOW64\bcryptprimitives.dll'. Symbols loaded.
INTEL_GT_DEBUGGER: (1257658) Received a process destroy event for pid: 1352
'HelloWorld.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel.appcore.dll'. Symbols loaded.
The thread 0x266c has exited with code 0 (0x0).
The thread 0x213c has exited with code 0 (0x0).
The thread 0x2068 has exited with code 0 (0x0).
The program '[1352] HelloWorld.exe' has exited with code 0 (0x0).

From what I understand the Bullet handles the physics and mathematics but how do I actually see (according to the description of the tutorial) - "to initialise Bullet, set up a dynamics world, and allow a sphere to fall onto a surface."

But when I debug, I get the above messages and then nothing happens, do I need OpenGL to actually visualize? How do I see the sphere falling onto a surface.

I guess what I am saying is, how do I provide this code to an OpenGL program?

In the long run, I have a OpenGL program with Spheres flying in random directions, but how do I provide object collision to that program?
User avatar
Typhontaur
Posts: 135
Joined: Fri Nov 04, 2005 2:22 pm

Re: Seeing Output of Program

Post by Typhontaur »

HI! ;)
there are no errors in the initialization,
but there are no a loop (press a key to exit?) and an output (OpenGL?)
otherwise the program cleaning up all
and return 0

*edit: you can try BasicDemo...
Basroil
Posts: 463
Joined: Fri Nov 30, 2012 4:50 am

Re: Seeing Output of Program

Post by Basroil »

Fudz4 wrote: But when I debug, I get the above messages and then nothing happens, do I need OpenGL to actually visualize? How do I see the sphere falling onto a surface.

I guess what I am saying is, how do I provide this code to an OpenGL program?

In the long run, I have a OpenGL program with Spheres flying in random directions, but how do I provide object collision to that program?
Of course you need a graphics backend, right now you only have physics!

If you're using VS, go to build (or build3) and execute the VS bat to make a solution file with all the tutorials. Check the way openGL is used there and you should be able to understand how to set that up in your own code. In general, just use motion states to copy transforms from the physics into your opengl code
Fudz4
Posts: 6
Joined: Tue Apr 05, 2016 2:27 pm

Re: Seeing Output of Program

Post by Fudz4 »

Typhontaur wrote:HI! ;)
there are no errors in the initialization,
but there are no a loop (press a key to exit?) and an output (OpenGL?)
otherwise the program cleaning up all
and return 0

*edit: you can try BasicDemo...
Basroil wrote:
Fudz4 wrote: But when I debug, I get the above messages and then nothing happens, do I need OpenGL to actually visualize? How do I see the sphere falling onto a surface.

I guess what I am saying is, how do I provide this code to an OpenGL program?

In the long run, I have a OpenGL program with Spheres flying in random directions, but how do I provide object collision to that program?
Of course you need a graphics backend, right now you only have physics!

If you're using VS, go to build (or build3) and execute the VS bat to make a solution file with all the tutorials. Check the way openGL is used there and you should be able to understand how to set that up in your own code. In general, just use motion states to copy transforms from the physics into your opengl code
Thanks guys I worked at it and I now have it all working :) trying to detect collision using flags now but everytime there is a collision it crashes. I guess I could try throwing exceptions.
Post Reply