Page 1 of 1

Getting errors using bullet demo in MFC

Posted: Wed May 21, 2014 4:09 am
by ptLeng
Hi, I want to use a MFC program to show the CollisionInterfaceDemo. I call the bullet Physics in the menu code. The code is:
void CMainFrame::OnCollisionDetection()
{
// TODO: Add your command handler code here
int screenWidth = 640;
int screenHeight = 480;
BulletCollisionDetection* pCollisionDetection = new BulletCollisionDetection;

pCollisionDetection->initPhysics();
pCollisionDetection->clientResetScene();

glutmain(__argc, __argv,screenWidth,screenHeight,"Collision Interface Demo",pCollisionDetection);
}
I compile the code, the VS2010 compiler says that:
error C2661: 'GlutDemoApplication::operator new' : no overloaded function takes 3 arguments

Can anybody help me? Thanks.

Re: Getting errors using bullet demo in MFC

Posted: Wed May 21, 2014 7:19 am
by Basroil
ptLeng wrote: BulletCollisionDetection* pCollisionDetection = new BulletCollisionDetection;
1) You should check the demos, you would have seen that your line wasn't needed and instead you need something like:

Code: Select all

	m_collisionConfiguration = new btDefaultCollisionConfiguration();

	m_dispatcher = new btCollisionDispatcher(m_collisionConfiguration);
2) Even Microsoft suggests against using MFC since it doesn't scale well and might not be 100% future compatible. Not necessarily an error, but something to think about.

Re: Getting errors using bullet demo in MFC

Posted: Fri May 23, 2014 3:02 am
by ptLeng
Thanks Basroil.
I use another way to show the bullet demo and it works.
That is:
code:
BulletCollisionDetection m_CollisionDetection;

m_CollisionDetection.initPhysics();
m_CollisionDetection.clientResetScene();

glutmain(__argc, __argv,screenWidth,screenHeight,"Collision Interface Demo",&m_CollisionDetection);

Now I test the way you told me.
-ptLeng

Re: Getting errors using bullet demo in MFC

Posted: Fri May 23, 2014 3:46 am
by Basroil
ptLeng wrote:Thanks Basroil.
I use another way to show the bullet demo and it works.
That is:
code:
BulletCollisionDetection m_CollisionDetection;

m_CollisionDetection.initPhysics();
m_CollisionDetection.clientResetScene();

glutmain(__argc, __argv,screenWidth,screenHeight,"Collision Interface Demo",&m_CollisionDetection);

Now I test the way you told me.
-ptLeng

Looks like I mistook that demo class for the actual collision detection class. You can strike the other post since it's not going to work :oops:

Re: Getting errors using bullet demo in MFC

Posted: Tue Sep 23, 2014 2:17 am
by Songhui005933
I also learning how to use bullet demo in MFC , but i can't find the related resources on the Internet , can you share your source to me ~thanks!!