Getting errors using bullet demo in MFC

Post Reply
ptLeng
Posts: 4
Joined: Sat May 17, 2014 4:12 am

Getting errors using bullet demo in MFC

Post 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.
Basroil
Posts: 463
Joined: Fri Nov 30, 2012 4:50 am

Re: Getting errors using bullet demo in MFC

Post 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.
ptLeng
Posts: 4
Joined: Sat May 17, 2014 4:12 am

Re: Getting errors using bullet demo in MFC

Post 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
Basroil
Posts: 463
Joined: Fri Nov 30, 2012 4:50 am

Re: Getting errors using bullet demo in MFC

Post 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:
Songhui005933
Posts: 1
Joined: Thu Sep 18, 2014 2:55 am

Re: Getting errors using bullet demo in MFC

Post 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!!
Post Reply