Fix for issue #192
Also: Avoid divide by zero before OpenGL window is up
This commit is contained in:
@@ -17,6 +17,10 @@ subject to the following restrictions:
|
|||||||
#include "GlutStuff.h"
|
#include "GlutStuff.h"
|
||||||
#include "GLDebugDrawer.h"
|
#include "GLDebugDrawer.h"
|
||||||
#include "btBulletDynamicsCommon.h"
|
#include "btBulletDynamicsCommon.h"
|
||||||
|
#ifdef __DEBUG_FPU_ISSUES
|
||||||
|
#define _GNU_SOURCE
|
||||||
|
#include <fenv.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
GLDebugDrawer gDebugDrawer;
|
GLDebugDrawer gDebugDrawer;
|
||||||
|
|
||||||
@@ -25,6 +29,14 @@ int main(int argc,char** argv)
|
|||||||
|
|
||||||
CcdPhysicsDemo* ccdDemo = new CcdPhysicsDemo();
|
CcdPhysicsDemo* ccdDemo = new CcdPhysicsDemo();
|
||||||
|
|
||||||
|
#ifdef __DEBUG_FPU_ISSUES
|
||||||
|
// feenableexcept (FE_DIVBYZERO);
|
||||||
|
// feenableexcept (FE_INEXACT);
|
||||||
|
// feenableexcept (FE_INVALID);
|
||||||
|
// feenableexcept (FE_OVERFLOW|FE_DIVBYZERO|FE_UNDERFLOW);
|
||||||
|
// feenableexcept (FE_UNDERFLOW);
|
||||||
|
#endif
|
||||||
|
|
||||||
ccdDemo->initPhysics();
|
ccdDemo->initPhysics();
|
||||||
ccdDemo->getDynamicsWorld()->setDebugDrawer(&gDebugDrawer);
|
ccdDemo->getDynamicsWorld()->setDebugDrawer(&gDebugDrawer);
|
||||||
|
|
||||||
|
|||||||
@@ -200,6 +200,9 @@ void DemoApplication::updateCamera() {
|
|||||||
m_cameraPosition[2] = eyePos.getZ();
|
m_cameraPosition[2] = eyePos.getZ();
|
||||||
m_cameraPosition += m_cameraTargetPosition;
|
m_cameraPosition += m_cameraTargetPosition;
|
||||||
|
|
||||||
|
if (m_glutScreenWidth == 0 && m_glutScreenHeight == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
if (m_glutScreenWidth > m_glutScreenHeight)
|
if (m_glutScreenWidth > m_glutScreenHeight)
|
||||||
{
|
{
|
||||||
btScalar aspect = m_glutScreenWidth / (btScalar)m_glutScreenHeight;
|
btScalar aspect = m_glutScreenWidth / (btScalar)m_glutScreenHeight;
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ public:
|
|||||||
int m_numConstraintRows,nub;
|
int m_numConstraintRows,nub;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct btConstraintInfo2 {
|
ATTRIBUTE_ALIGNED16(struct) btConstraintInfo2 {
|
||||||
// integrator parameters: frames per second (1/stepsize), default error
|
// integrator parameters: frames per second (1/stepsize), default error
|
||||||
// reduction parameter (0..1).
|
// reduction parameter (0..1).
|
||||||
btScalar fps,erp;
|
btScalar fps,erp;
|
||||||
|
|||||||
@@ -130,8 +130,8 @@ inline int btGetVersion()
|
|||||||
//non-windows systems
|
//non-windows systems
|
||||||
|
|
||||||
#define SIMD_FORCE_INLINE inline
|
#define SIMD_FORCE_INLINE inline
|
||||||
#define ATTRIBUTE_ALIGNED16(a) a
|
#define ATTRIBUTE_ALIGNED16(a) a __attribute__ ((aligned (16)))
|
||||||
#define ATTRIBUTE_ALIGNED128(a) a
|
#define ATTRIBUTE_ALIGNED128(a) a __attribute__ ((aligned (128)))
|
||||||
#ifndef assert
|
#ifndef assert
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user