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

Author Topic: SFML Light System - Let There Be Light  (Read 229311 times)

0 Members and 1 Guest are viewing this topic.

kralo9

  • Newbie
  • *
  • Posts: 44
    • View Profile
    • Email
Re: SFML Light System - Let There Be Light
« Reply #180 on: January 30, 2013, 04:54:14 pm »
Quote
EDIT: I fixed it! It's working fine now. It turns out m_lightAttenuationShader.unbind(); was important. I replaced it with:

Code: [Select]
//this is the replacement for unbind
sf::priv::GlContext::ensureContext();
glCheck(glUseProgramObjectARB(0));

since the unbind function was removed in this commit: https://github.com/SFML/SFML/commit/121cfeb6a3685e2529b717d5667ee6601533c30e

I can't call function glCheck(glUseProgramObjectARB(0));
Where is it implemented?
I'm totally exhausted. I've got 3 children and no money! Why can't I have no children and 3 money? - Homer S.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: SFML Light System - Let There Be Light
« Reply #181 on: January 30, 2013, 05:00:50 pm »
With recent sources you can now call sf::Shader::bind(NULL) instead.
Laurent Gomila - SFML developer

kralo9

  • Newbie
  • *
  • Posts: 44
    • View Profile
    • Email
Re: SFML Light System - Let There Be Light
« Reply #182 on: February 04, 2013, 08:13:56 pm »
Amazin. Actually with latest sources unbind() is available and working too. But I got a new problem. When im calling SetCenter() on a ltbl::light_point the program seems to crash as soon as I move a light long distances. For example from 0,0 to 800,400 (immediatly).

What may cause that problem?
Removing that call to the function makes the program uncrashable, but this is not what I'm looking for.
I'm totally exhausted. I've got 3 children and no money! Why can't I have no children and 3 money? - Homer S.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: SFML Light System - Let There Be Light
« Reply #183 on: February 04, 2013, 08:22:21 pm »
Quote
Actually with latest sources unbind() is available and working too
Hmmm... no?

Quote
But I got a new problem. When im calling SetCenter() on a ltbl::light_point the program seems to crash as soon as I move a light long distances. For example from 0,0 to 800,400 (immediatly).
You're trying to move your light faster than the speed of light, it creates a wormhole in the universe which obviously makes your program crash.
Seriously? I have no idea, but it's not a SFML bug. Moving something doesn't do anything critical, just assigning a few floats. And for SFML there's no difference between a small move and a big move.
Laurent Gomila - SFML developer

kralo9

  • Newbie
  • *
  • Posts: 44
    • View Profile
    • Email
Re: SFML Light System - Let There Be Light
« Reply #184 on: February 04, 2013, 08:44:45 pm »
Hm. Maybe I downloaded somehow wrong version of sfml2... where do I really download the latest sources?? :/
Maybe this causes the problem too.
Sorry if I'm too stupid for that.

Github or sfml homepage? I tried sfml2rc...
Github is a bit confusing me because it is not handy enough for me
« Last Edit: February 04, 2013, 10:35:05 pm by kralo9 »
I'm totally exhausted. I've got 3 children and no money! Why can't I have no children and 3 money? - Homer S.

natchos

  • Jr. Member
  • **
  • Posts: 97
    • View Profile
    • Email
Re: SFML Light System - Let There Be Light
« Reply #185 on: February 04, 2013, 10:52:20 pm »
Excuse me if this sounds dumb, but with the the version of SFML I have(downloaded a week or so ago) sf::shader::bind() can no longer be called with no arguments. Should I replace all calls to bind with no arguments with bind(NULL)?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: SFML Light System - Let There Be Light
« Reply #186 on: February 04, 2013, 11:04:49 pm »
Build the API documentation, and read it ;)

// bind a shader
sf::Shader::bind(&shader);

// bind nothing
sf::Shader::bind(NULL);
Laurent Gomila - SFML developer

kralo9

  • Newbie
  • *
  • Posts: 44
    • View Profile
    • Email
Re: SFML Light System - Let There Be Light
« Reply #187 on: February 04, 2013, 11:06:24 pm »
I dont want to be inpolite, but in my opinion you cant be sure if that what you downloaded is really the latest version. Seems like I am not the only one having problems with that. Some explicit hints/links to the latest sources would be great. I would find 2 different downloads of SFML2 (like it seels to be) in the download section on the sfml homepage.

Edit: Ok only I am too stupid for downloading :/
« Last Edit: February 04, 2013, 11:08:13 pm by kralo9 »
I'm totally exhausted. I've got 3 children and no money! Why can't I have no children and 3 money? - Homer S.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: SFML Light System - Let There Be Light
« Reply #188 on: February 04, 2013, 11:14:09 pm »
Isn't the "Latest development snapshot" section of the download page explicit enough?
Laurent Gomila - SFML developer

kralo9

  • Newbie
  • *
  • Posts: 44
    • View Profile
    • Email
Re: SFML Light System - Let There Be Light
« Reply #189 on: February 04, 2013, 11:19:07 pm »
Isn't the "Latest development snapshot" section of the download page explicit enough?
Well, it is yes. But why that big table under it? That confused me.
Ok I will try that snapshot and hope it is not crashing anymore when moving lights faster than its speed...
Sorry for my incompetence. Seems I am stupid.

I wanted to add that I like non-oversized-communities line this is, where you even get answers from developers.
« Last Edit: February 04, 2013, 11:21:16 pm by kralo9 »
I'm totally exhausted. I've got 3 children and no money! Why can't I have no children and 3 money? - Homer S.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: SFML Light System - Let There Be Light
« Reply #190 on: February 05, 2013, 08:08:00 am »
Quote
Well, it is yes. But why that big table under it?
The latest sources are just one archive, a single link is enough.
A release has many many pre-compiled packages, thus it requires a big table ;)
Laurent Gomila - SFML developer

natchos

  • Jr. Member
  • **
  • Posts: 97
    • View Profile
    • Email
Re: SFML Light System - Let There Be Light
« Reply #191 on: February 05, 2013, 09:29:25 am »
Build the API documentation, and read it ;)

// bind a shader
sf::Shader::bind(&shader);

// bind nothing
sf::Shader::bind(NULL);

But what did the old call to ::bind with no arguments do? Did it do the same thing as calling ::bind(NULL)? Since I don't know what the old calls did, I don't know if ::bind(NULL) does the same thing.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: SFML Light System - Let There Be Light
« Reply #192 on: February 05, 2013, 10:37:38 am »
// the old...
shader.bind();

// ...is equivalent to the new...
sf::Shader::bind(&shader);

// the old...
shader.unbind();

// ...is equivalent to the new...
sf::Shader::bind(NULL);
Laurent Gomila - SFML developer

natchos

  • Jr. Member
  • **
  • Posts: 97
    • View Profile
    • Email
Re: SFML Light System - Let There Be Light
« Reply #193 on: February 05, 2013, 04:45:04 pm »
// the old...
shader.bind();

// ...is equivalent to the new...
sf::Shader::bind(&shader);

// the old...
shader.unbind();

// ...is equivalent to the new...
sf::Shader::bind(NULL);

Okay, thank you for clearing that up.

EDIT: is this true for other classes ::bind, such as sf::texture::bind?
« Last Edit: February 05, 2013, 04:54:27 pm by natchos »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: SFML Light System - Let There Be Light
« Reply #194 on: February 05, 2013, 08:15:46 pm »
Yes.
Laurent Gomila - SFML developer