SFML community forums

Help => Window => Topic started by: panithadrum on March 03, 2010, 09:38:42 pm

Title: RenderImage vs GL
Post by: panithadrum on March 03, 2010, 09:38:42 pm
I am wondering something about render images... this code makes the render image to copy all the pixels from GL to sf::Image? If so, when? Just when I call display?
Code: [Select]
sf::RenderImage image;
image.Create(100, 100);
image.SetActive(true);
glClearColor(0.f, 0.f, 0.f, 0.f);
glClear(GL_COLOR_BUFFER_BIT);
image.Display();
image.GetImage().SaveToFile("lol.png");
Title: RenderImage vs GL
Post by: Laurent on March 04, 2010, 07:33:31 am
It depends, RenderImage uses two different techniques (depending on what your driver supports). The first one directly renders to the image, there's no extra copy at the end. The other one needs a copy, which is done in Display().

Why are you asking that?
Title: RenderImage vs GL
Post by: panithadrum on March 04, 2010, 12:11:18 pm
Because I'm going to make a 2D lightning engine, and I need to render to an image (using OpenGL). It's crucial to know if RenderImage keeps making copies of the OGL textures everytime I render something.

So you solved it. Great :-)