Cannot pass surface to SDL_LockTexture

Issue #42 resolved
Mikko Ronkainen
created an issue
texture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, width, height)
surface = SDL_CreateRGBSurface(0, width, height, 32, 0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000)
SDL_LockTexture(texture, 0, ctypes.byref(surface.contents.pixels), ctypes.byref(surface.contents.pitch))

byref() argument must be a ctypes instance, not 'int'

How should the SDL_LockTexture be called? I couldn't find any examples from the tests. Do the pixels/pitch members have wrong types after SDL_CreateRGBSurface or am I just calling the function in a wrong way?

Comments (1)

  1. Marcus von Appen repo owner
    SDL_LockTexture(texture,0,ctypes.byref(surface.contents.pixels), surface.contents.pitch)
    

    The last byref() is unnecessary, since the function itself expects an int as argument, not a pointer to an int.

  2. Log in to comment