| Unable to access SDL_Texture element ( w, and h) |
| Unable to access SDL_Texture element ( w, and h) |
|
Jonas Kulla
Guest
|
2014-02-12 6:05 GMT+01:00 keestu:
SDL_Texture is an opaque struct. To get information about it, use http://wiki.libsdl.org/SDL_QueryTexture |
|||||||||||||
|
|
||||||||||||||
|
keestu
|
So kind of you.
|
|||||||||||
|
|
||||||||||||
|
keestu
|
Between, how do we access the pixels, and pitches members of SDL_Texture through SDL_QueryTexture, i did not find . kindly point out?
|
|||||||||||
|
|
||||||||||||
|
keestu
|
Well, looks like SDL_LockTexture can help me
|
|||||||||||
|
|
||||||||||||
| Unable to access SDL_Texture element ( w, and h) |
|
Jonas Kulla
Guest
|
2014-02-12 6:21 GMT+01:00 keestu:
I think you are confusing SDL_Texture with SDL_Surface, they are not the same. A texture is a resource managed by the underlying graphics implementation, and will therefore often live in GPU memory, so you have no direct pixel access via a memory pointer to it. Instead, you have to update it's contents with either SDL_UpdateTexture() (for static textures) or alternatively SDL_Lock/UnlockTexture() (for streaming textures). As for the pitch, I think you can calculate that parameter off of the pixel format, although SDL_LockTexture() returns it for your convenience. |
|||||||||||||
|
|
||||||||||||||

