Class SDL_Texture

  • All Implemented Interfaces:
    com.sun.jna.NativeMapped

    public final class SDL_Texture
    extends com.sun.jna.PointerType
    An efficient driver-specific representation of pixel data.

    SDL_Texture is used in a hardware rendering and textures are stored in GPU memory (where available). Therefore the program doesn't have access to it directly, unlike in SDL_Surface. The rendering operations are accelerated by GPU (where available), using, internally, either OpenGL or DirectX (available only on Windows) API, which in turn are using your video hardware, hence the hardware rendering.

    SDL_Surface, on the other hand, stores pixel data in the regular RAM and in most cases you can access data buffer associated with surface directly, modifying its content, i.e. it is using CPU, hence the software rendering.

    SDL_Surface is the original image data structure from SDL 1.x. SDL_Texture was added in SDL 2.x for hardware optimized rendering.

    You can convert SDL_Surface to SDL_Texture using SDL_CreateTextureFromSurface(...), after which you can release the SDL_Surface memory by SDL_FreeSurface(...)

    • Constructor Detail

      • SDL_Texture

        public SDL_Texture()
      • SDL_Texture

        public SDL_Texture​(com.sun.jna.Pointer p)