Hi everyone :-)
First of all, thanks for a possibility to play with Havok just for
free, I think this is a great thing for all of computer graphics
enthusiasts :-)
I have been working on kind of academic research, trying to compare
different Physics Engines. I am to write similiar application -
simulating massive number of objects' collisions - under Havok, PhysX
and ODE. Being honest, PhysX (release done by AGEIA, not nVidia) comes
with great "Training Programs" tutorials and with ODE also I had no big
problems. And now.... I am stucked on Havok ;-) This is kind of
different.... But getting to important things: I would like to
integrate it with glut - I would like glut (and OpenGL) to do rendering
and from Hkp only get results from simulation, e.g. rigid bodies'
positions. So first: is this possible? (I suspect that it is.. but who
knows... ;-) ).
The second - more general question - how to actually start? I know, I
know that there is this demo thing, which is kind of confusing at first
glance, besides I guess it is integrated with D3D rather then OGL. So I
started to do things like they say in Documentation, but there also -
problems. I am pretty sure I did like they say there but here are some
problems:
when I try to make a step in simulation:
- Warning: 'Severe performance and stability warning: The stack
size in hkMemory is insufficient to solve the current constraint
system. Allocating from system memory. This can fragment your memory.'
.. and this despite I am allocating stack of size of 512 MB
(setStackArea() method)
- Warning: 'The system has requested a heap allocation on stack
overflow. The requested size is 8208 and the allocated size is
536870912 This can lead to large slowdowns. To fix this, you should
call hkThreadMemory::setStackArea() with larger buffer. [... ] ' ...
and this is printed when m_world->removeReference() is being called.
This is how I initialize Havok:
int stackSize = 512 * STACK_1MB;
hkMemory* memoryManager = new hkPoolMemory();
hkThreadMemory threadMemory(memoryManager);
hkBaseSystem::init(memoryManager, &threadMemory, PrintError);
char* stackBuffer = hkAllocate(stackSize, HK_MEMORY_CLASS_BASE);
threadMemory.setStackArea(stackBuffer, stackSize);
//hkThreadMemory::getInstance().setStackArea(stackBuffer, stackSize);
memoryManager->removeReference();
hkpWorldCinfo info;
#ifdef CONTINUOUS_PHYSICS
info.m_simulationType = hkpWorldCinfo::SIMULATION_TYPE_CONTINUOUS;
#else
info.m_simulationType = hkpWorldCinfo::SIMULATION_TYPE_DISCRETE;
#endif
info.m_gravity = gDefaultGravity;
info.m_collisionTolerance = C_TOLERANCE;
info.setBroadPhaseWorldSize(gWorldSize);
info.m_broadPhaseBorderBehaviour = hkpWorldCinfo::BROADPHASE_BORDER_ASSERT;
info.m_enableDeactivation = false;
info.setupSolverInfo(hkpWorldCinfo::SOLVER_TYPE_4ITERS_MEDIUM);
world = new hkpWorld(info);
 
; hkpAgentRegisterUtil::registerAllAgents(world->getCollisionDispatcher());
}
and finally release resources:
world->removeReference();
world = HK_NULL;
hkBaseSystem::quit();
I'd be tremendously grateful for all help.
Actually I dream of little stand-alone app, that would do some kind of
simulation and don't argue with graphics engine...
Sorry for such a long post and I hope that I haven't offended anyone
mentioning other technologies. If I did - I'm sorry - just let me know.
Thanks, I'm waiting for reply.


