Integrating force feedback with a complete real-time virtual environment system presents problems which are more difficult than those encountered in building simpler force-feedback systems. In particular, lengthly computations for graphics or simulation require a decoupling of the haptic servo loop from the main application loop if high-quality forces are to be produced. We present some approaches to these problems and describe our force-feedback software library which implements these techniques and provides other benefits including haptic-textured surfaces, device independence, distributed operation and easy enhancement.