Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: RenderImage vs GL  (Read 2165 times)

0 Members and 1 Guest are viewing this topic.

panithadrum

  • Sr. Member
  • ****
  • Posts: 304
    • View Profile
    • Skyrpex@Github
    • Email
RenderImage vs GL
« 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");

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
RenderImage vs GL
« Reply #1 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?
Laurent Gomila - SFML developer

panithadrum

  • Sr. Member
  • ****
  • Posts: 304
    • View Profile
    • Skyrpex@Github
    • Email
RenderImage vs GL
« Reply #2 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 :-)

 

anything