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

Author Topic: New Shader class in SFML 2 to replace PostFx  (Read 39500 times)

0 Members and 1 Guest are viewing this topic.

l0calh05t

  • Full Member
  • ***
  • Posts: 200
    • View Profile
New Shader class in SFML 2 to replace PostFx
« Reply #45 on: November 18, 2009, 06:35:41 pm »
Quote from: "Laurent"
My rule is that context settings are only a hint, and if any of them is not supported then SFML will try to find the closest valid match. So no, no failure will happen. And you can request the actual settings that were used with Window::GetSettings().


About this:
When I request GL 3.0, I get a 3.0 context. Requesting a 3.1 context fails, but falls back to 2.0 instead of 3.0. I think the minor version should be lowered first.
Also, if I use an invalid MSAA level, the fallback fails (even though antialiasing usually works)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
New Shader class in SFML 2 to replace PostFx
« Reply #46 on: November 18, 2009, 06:51:59 pm »
Quote
When I request GL 3.0, I get a 3.0 context. Requesting a 3.1 context fails, but falls back to 2.0 instead of 3.0. I think the minor version should be lowered first

Yeah, maybe.

Quote
Also, if I use an invalid MSAA level, the fallback fails (even though antialiasing usually works)

Really? When AA fails I just lower the value and call the same function again and again, until it works. When 0 is reached, the execution is exactly the same as if you passed 0 directly.
Maybe you can run your program step-by-step in debug mode to see what happens in SFML?
Laurent Gomila - SFML developer

l0calh05t

  • Full Member
  • ***
  • Posts: 200
    • View Profile
New Shader class in SFML 2 to replace PostFx
« Reply #47 on: November 18, 2009, 09:43:22 pm »
Looks like the error is in line 184 of ContextWGL.cpp:

mySettings.AntialiasingLevel = intAttributes[1] = 2;

this should actually be

mySettings.AntialiasingLevel = intAttributes[11] = 2;

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
New Shader class in SFML 2 to replace PostFx
« Reply #48 on: November 18, 2009, 10:36:10 pm »
That's so stupid :shock:

Thank you very much, it's now fixed :)
Laurent Gomila - SFML developer

OniLinkPlus

  • Hero Member
  • *****
  • Posts: 500
    • View Profile
New Shader class in SFML 2 to replace PostFx
« Reply #49 on: November 19, 2009, 03:25:20 am »
I got the debug binaries working. Blackness when I use RenderImage. Nothing in stderr, either.
I use the latest build of SFML2

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
New Shader class in SFML 2 to replace PostFx
« Reply #50 on: November 19, 2009, 07:28:51 am »
Quote
I got the debug binaries working. Blackness when I use RenderImage. Nothing in stderr, either.

What about the Shader sample? Does it work?
Laurent Gomila - SFML developer

OniLinkPlus

  • Hero Member
  • *****
  • Posts: 500
    • View Profile
New Shader class in SFML 2 to replace PostFx
« Reply #51 on: November 20, 2009, 04:25:53 am »
Quote from: "Laurent"
Quote
I got the debug binaries working. Blackness when I use RenderImage. Nothing in stderr, either.

What about the Shader sample? Does it work?
Yes. It's probably a problem with sf::RenderImage, as that is where my problem is at.
I use the latest build of SFML2

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
New Shader class in SFML 2 to replace PostFx
« Reply #52 on: November 20, 2009, 08:09:18 am »
Quote
Yes. It's probably a problem with sf::RenderImage, as that is where my problem is at.

But the shader sample uses a RenderImage as well, so the problem might be from your code.
Laurent Gomila - SFML developer

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
New Shader class in SFML 2 to replace PostFx
« Reply #53 on: December 03, 2009, 09:53:22 am »
Quote
When I request GL 3.0, I get a 3.0 context. Requesting a 3.1 context fails, but falls back to 2.0 instead of 3.0. I think the minor version should be lowered first.

Done in latest sfml2 revision.
Laurent Gomila - SFML developer

Oz1571

  • Newbie
  • *
  • Posts: 28
    • View Profile
New Shader class in SFML 2 to replace PostFx
« Reply #54 on: December 03, 2009, 05:38:37 pm »
After updating to the latest version, my game now freezes completely at

Screen.Create(mode, "oglgame", sf::Style::Resize | sf::Style::Close, settings);

If I set the opengl version to 2.x instead of 3.x, it works fine. I last updated less than 24h ago and it worked fine. Maybe this thread isn't the right place to post this in, I guess it could be an unrelated problem.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
New Shader class in SFML 2 to replace PostFx
« Reply #55 on: December 03, 2009, 05:48:12 pm »
You're right, this was a stupid error related to this modification today. Now it should work.

Thanks for your quick feedback :)
Laurent Gomila - SFML developer

Oz1571

  • Newbie
  • *
  • Posts: 28
    • View Profile
New Shader class in SFML 2 to replace PostFx
« Reply #56 on: December 03, 2009, 05:56:52 pm »
Haha, thanks for the quick fix. It does indeed work fine again. :)

panithadrum

  • Sr. Member
  • ****
  • Posts: 304
    • View Profile
    • Skyrpex@Github
    • Email
New Shader class in SFML 2 to replace PostFx
« Reply #57 on: December 03, 2009, 06:08:52 pm »
The shader example has one error: the global shader mousey parameters seems to be working like 1-mouseY.

If you replace the update code like this, it works.

Code: [Select]
// Update the shaders
backgroundShader.Update(mouseX, mouseY);
entityShader.Update(mouseX, mouseY);
globalShader.Update(mouseX, 1-mouseY);

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
New Shader class in SFML 2 to replace PostFx
« Reply #58 on: December 03, 2009, 06:44:53 pm »
It fixes only the "fisheye" effect, all other effects get broken.

This is not really an error, actually the fisheye effect should be more complex in order to handle properly the texture coordinates.
Laurent Gomila - SFML developer

panithadrum

  • Sr. Member
  • ****
  • Posts: 304
    • View Profile
    • Skyrpex@Github
    • Email
New Shader class in SFML 2 to replace PostFx
« Reply #59 on: December 03, 2009, 07:25:49 pm »
I thought the problem wasn't fisheye, but globalShader :D

Is it because you are using a RenderImage?