A pointer to the pixeldata,
1 auto window = new Window(800, 400, "myTestWindow"); //create a window 2 auto texture = new Texture(window, 300, 100); //create a texture 3 uint* pixels = texture.lock() //lock the texture and get the pixeldata pointer 4 pixels[10 * texture.getWidth() + 20] = 0x00FF0000; // make the pixel at position 20, 10 red 5 texture.lock() //now were done manipulating the pixels, unlock the texture 6 * 7 // render the texture to the window 8 SDL_RenderCopy(window.getRenderer(), texture.getTexture(), SDL_Rect(0,0,300,100), SDL_Rect(0,0,800,400)); 9 SDL_RenderPresent(window.getRenderer());
*
Lock the texture to manipulate its pixeldata * Locks the thexture meaning that the texture can't be used for anything untill its $(CU unlock) method is called * A pointer is returned. It points to the pixeldata wich can be manipulated. The length of the pixeldata is the textures width*height. The value for a pixel at location x, y can be obtained by getting the element at index y * width + x *