---
name: "SDL_OpenHaptic"
section: "3"
platform: "linux"
package: "libsdl3-doc"
version: "3.2.10+ds-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/SDL_OpenHaptic"
---

# SDL\_OpenHaptic(3)

Open a haptic device for use.

## NAME

SDL\_OpenHaptic - Open a haptic device for use.

## HEADER FILE

Defined in SDL3/SDL\_haptic.h

## SYNOPSIS

```
#include "SDL3/SDL.h"
```

**SDL\_Haptic \* SDL\_OpenHaptic(SDL\_HapticID instance\_id);**

## DESCRIPTION

The index passed as an argument refers to the N'th haptic device on this system.

When opening a haptic device, its gain will be set to maximum and autocenter will be disabled. To modify these values use

**SDL\_SetHapticGain** () and

**SDL\_SetHapticAutocenter** ().

## FUNCTION PARAMETERS

- *instance\_id*

  the haptic device instance ID.

## RETURN VALUE

( **SDL\_Haptic**\
  \*) Returns the device identifier or NULL on failure; call  **SDL\_GetError** () for more information.

## AVAILABILITY

This function is available since SDL 3.2.0.

## SEE ALSO

**•**(3), [**SDL\_CloseHaptic**(3)](/SDL_CloseHaptic/3.md), **•**(3), [**SDL\_GetHaptics**(3)](/SDL_GetHaptics/3.md), **•**(3), [**SDL\_OpenHapticFromJoystick**(3)](/SDL_OpenHapticFromJoystick/3.md), **•**(3), [**SDL\_OpenHapticFromMouse**(3)](/SDL_OpenHapticFromMouse/3.md), **•**(3), [**SDL\_SetHapticAutocenter**(3)](/SDL_SetHapticAutocenter/3.md), **•**(3), [**SDL\_SetHapticGain**(3)](/SDL_SetHapticGain/3.md)
