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

Author Topic: SFML simple shader experiment  (Read 16643 times)

0 Members and 1 Guest are viewing this topic.

SpeCter

  • Full Member
  • ***
  • Posts: 151
    • View Profile
Re: SFML simple shader experiment
« Reply #15 on: April 02, 2015, 10:15:30 am »
Your Walkers all behave the same(color,movement,initial position) now, at least for me. gcc's implementation of the random_device is broken on windows so if you use gcc your random number generator gets seeded with the same value for every walker. A workaround would be to use only one rng and pass that around. Your programm will do the same each time you start, but it will at least give your walkers different values.

I don't know what the others think but imo you should initialise POD-Types(char,int,float etc.) like this:
int value = 0;

instead of:

int value{ 0 };

And global variables are a big no-no.

Miretz

  • Newbie
  • *
  • Posts: 12
    • View Profile
    • Miretz Github
    • Email
Re: SFML simple shader experiment
« Reply #16 on: April 02, 2015, 10:43:07 am »
Yes. I found out it doesn't even compile now in VS2013. In Code::Blocks (GCC) on Linux it works fine.

I will try the workaround for rng you are suggesting.

Thanks :)

Miretz

  • Newbie
  • *
  • Posts: 12
    • View Profile
    • Miretz Github
    • Email
Re: SFML simple shader experiment
« Reply #17 on: April 03, 2015, 02:17:05 pm »
Newest version on github:
https://github.com/Miretz/FollowersOfLight

- refactored into multiple classes
- created RandomGenerator class
- created ShaderLoader class

ChronicRat

  • Sr. Member
  • ****
  • Posts: 327
  • C++ programmer
    • View Profile
    • My blog
Re: SFML simple shader experiment
« Reply #18 on: April 04, 2015, 07:18:04 pm »
Cool, much better. =) Btw, if you are using C++11, there is 'default' keyword for empty ctors/dtors. And read this or something other about member initialising.