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

Author Topic: SFML and render  (Read 2251 times)

0 Members and 1 Guest are viewing this topic.

First

  • Newbie
  • *
  • Posts: 41
    • View Profile
    • Email
SFML and render
« on: April 22, 2014, 01:15:06 am »
SFML slows a bit when renders graphics. How to correctly render graphics without delay? Removed ContexSetting still slightly brakes? I draw this:

 If pereklVolt = 4 Then monopolik.Texture = New Texture("C:\1\volt1.gif") : pereklVolt += 1
            If pereklVolt = 3 Then monopolik.Texture = New Texture("C:\1\volt3.gif") : pereklVolt += 1
            If pereklVolt = 2 Then monopolik.Texture = New Texture("C:\1\volt2.gif") : pereklVolt += 1
            If pereklVolt = 1 Then monopolik.Texture = New Texture("C:\1\volt1.gif") : pereklVolt += 1

its right? help please

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10838
    • View Profile
    • development blog
    • Email
Re: SFML and render
« Reply #1 on: April 22, 2014, 01:38:50 am »
Create textures before hand and reuse them. If you always create a new one, then you'll always be loading the same data from the harddisk, which is a very slow process.

At best you use one texture with multiple images on it and then simply change the texture rect.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

First

  • Newbie
  • *
  • Posts: 41
    • View Profile
    • Email
Re: SFML and render
« Reply #2 on: April 22, 2014, 09:21:23 am »
that is, you must first create textures and upload them to draw a picture after? then I get a lot by constructing textures. it will not affect memory and performance?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10838
    • View Profile
    • development blog
    • Email
Re: SFML and render
« Reply #3 on: April 22, 2014, 09:29:29 am »
Read the tutorials; although it's not C# the theory is the same.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything