These functions are declared in the following header file:

     #include <allegro5/allegro_direct3d.h>

# al_get_d3d_device

    LPDIRECT3DDEVICE9 al_get_d3d_device(ALLEGRO_DISPLAY *display)

Source Code

Returns the Direct3D device of the display. The return value is undefined if the display was not created with the Direct3D flag.

Returns: A pointer to the Direct3D device.

Examples:

- ex_d3d.cpp

# al_get_d3d_system_texture

    LPDIRECT3DTEXTURE9 al_get_d3d_system_texture(ALLEGRO_BITMAP *bitmap)

Source Code

Returns the system texture (stored with the D3DPOOL_SYSTEMMEM flags). This texture is used for the render-to-texture feature set.

Returns: A pointer to the Direct3D system texture.

# al_get_d3d_video_texture

    LPDIRECT3DTEXTURE9 al_get_d3d_video_texture(ALLEGRO_BITMAP *bitmap)

Source Code

Returns the video texture (stored with the D3DPOOL_DEFAULT or D3DPOOL_MANAGED flags depending on whether render-to-texture is enabled or disabled respectively).

Returns: A pointer to the Direct3D video texture.

# al_have_d3d_non_pow2_texture_support

    bool al_have_d3d_non_pow2_texture_support(void)

Source Code

Returns whether the Direct3D device supports textures whose dimensions are not powers of two.

Returns: True if device supports NPOT textures, false otherwise.

# al_have_d3d_non_square_texture_support

    bool al_have_d3d_non_square_texture_support(void)

Source Code

Returns whether the Direct3D device supports textures that are not square.

Returns: True if the Direct3D device supports non-square textures, false otherwise.

# al_get_d3d_texture_size

    bool al_get_d3d_texture_size(ALLEGRO_BITMAP *bitmap, int *width, int *height)

Source Code

Retrieves the size of the Direct3D texture used for the bitmap.

Returns true on success, false on failure. Zero width and height are returned if the bitmap is not a Direct3D bitmap.

Since: 5.1.0

See also: al_get_d3d_texture_position

# al_get_d3d_texture_position

    void al_get_d3d_texture_position(ALLEGRO_BITMAP *bitmap, int *u, int *v)

Source Code

Returns the u/v coordinates for the top/left corner of the bitmap within the used texture, in pixels.

Parameters:

- bitmap - ALLEGRO_BITMAP to examine
- u - Will hold the returned u coordinate
- v - Will hold the returned v coordinate

See also: al_get_d3d_texture_size

# al_is_d3d_device_lost

    bool al_is_d3d_device_lost(ALLEGRO_DISPLAY *display)

Source Code

Returns a boolean indicating whether or not the Direct3D device belonging to the given display is in a lost state.

Parameters:

- display - The display that the device you wish to check is attached to

# al_set_d3d_device_release_callback

    void al_set_d3d_device_release_callback(
       void (*callback)(ALLEGRO_DISPLAY *display))

Source Code

The callback will be called whenever a D3D device is reset (minimize, toggle fullscreen window, etc). In the callback you should release any d3d resources you have created yourself. The callback receives the affected display as a parameter.

Pass NULL to disable the callback.

Since: 5.1.0

# al_set_d3d_device_restore_callback

    void al_set_d3d_device_restore_callback(
       void (*callback)(ALLEGRO_DISPLAY *display))

Source Code

The callback will be called whenever a D3D device that has been reset is restored. In the callback you should restore any d3d resources you have created yourself. The callback receives the affected display as a parameter.

Pass NULL to disable the callback.

Since: 5.1.0

Allegro version 5.2.11 - Last updated: 2026-02-09 02:00:42 UTC