I'm trying to fill texture buffer with numeric RGBA-values, but that doesn't work, window remains black.
RenderWindow window(VideoMode(SCR_WIDTH,SCR_HEIGHT),"test");
Texture bg;
Uint8* pixels = new Uint8[SCR_WIDTH * SCR_HEIGHT * 4];
for(int j=0;j<SCR_HEIGHT;j++)
for(int i=0;i<SCR_WIDTH;i++)
{
pixels[j*SCR_WIDTH*4+i*4]=50; //red
pixels[j*SCR_WIDTH*4+i*4+1]=j%255; // green
pixels[j*SCR_WIDTH*4+i*4+2]=j%255; // blue
pixels[j*SCR_WIDTH*4+i*4+3]=255;// alpha
}
bg.update(pixels);
Sprite sprite_bg;
sprite_bg.setTexture(bg);
while(window.isOpen()){
Event e;
while (window.pollEvent(e))
if (e.type==Event::Closed) window.close();
window.draw(sprite_bg);
window.display();
}
Win7x64, SFML 2.4.2, MinGW 7.2.0