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

Author Topic: Rendering n frames ahead  (Read 1980 times)

0 Members and 1 Guest are viewing this topic.

oomek

  • Jr. Member
  • **
  • Posts: 90
    • View Profile
    • Email
Rendering n frames ahead
« on: November 13, 2018, 02:21:49 pm »
Is it possible in SFML to create an array of  n rendertextures and draw to them sequentially untill all are filled in one thread and in another thread draw those framebuffers sequentially to the window without blocking the first thread? The reason for that is that the rendering thread sometimes pauses for 50-100ms when reloading textures from disk. I do not care much about the latency as it's not a game. An example using pseudo code would be handy.

NGM88

  • Full Member
  • ***
  • Posts: 162
    • View Profile
Re: Rendering n frames ahead
« Reply #1 on: November 21, 2018, 04:32:23 pm »
If this were StackOverflow someone would have probably asked "show us what you have so far". It helps if you post what you have tried.

ZeroZ30o

  • Newbie
  • *
  • Posts: 47
    • View Profile
Re: Rendering n frames ahead
« Reply #2 on: November 24, 2018, 07:50:13 pm »
Yes, it's possible.

See https://www.sfml-dev.org/tutorials/2.5/window-opengl.php#rendering-from-threads

And with mutexes on top.
I think this is a pretty silly solution though -one separate thread should load the data for sure, but:

If the problem is the loading, why buffer the textures as well? I'm assuming it takes almost no time for you to draw those files into the window (once they are loaded).

And now I speculate (might be 100% wrong):
Additionally, I suspect you may run into video ram issues with several render textures, where those too would be stored in memory if you run out of memory in your gpu (thus taking time to load back as well).
« Last Edit: November 24, 2018, 07:54:01 pm by ZeroZ30o »

 

anything