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

Author Topic: SFML 2.0 RC  (Read 127844 times)

0 Members and 5 Guests are viewing this topic.

mobai

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: SFML 2.0 RC
« Reply #180 on: September 05, 2012, 04:26:29 pm »
I already asked in the chat and it looks like there's something between sfml and the drivers that doesnt work well...

The whole thing is explained here: http://en.sfml-dev.org/forums/index.php?topic=9074.0

Foaly

  • Sr. Member
  • ****
  • Posts: 453
    • View Profile
Re: SFML 2.0 RC
« Reply #181 on: September 06, 2012, 12:30:47 pm »
I'm not sure, but i think i found an error in the documentation of sf::Shader...
If I create a shader like this:
sf::Shader shader;
shader.loadFromFile("Shader.frag", sf::Shader::Fragment);
and use it like it says in the documentation:
m_RenderTexture.draw(m_Circle, shader);
I get an error. It works when I do this:
m_RenderTexture.draw(m_Circle, &shader);

Same with the example that uses the renderstates. I have to pass the address not the value, like it says in the documentation.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: SFML 2.0 RC
« Reply #182 on: September 06, 2012, 12:53:08 pm »
m_RenderTexture.draw(m_Circle, &shader);
And that worked? :o

The draw function is taking the render states as reference, thus passing the adress to the function shouldn't work at all either...

See the two draw function declerations and the header to it.


Edit: I just now figured out how that all worked, since the documentation said that draw(obj, shader) is a short cut, but I couldn't see how it's being done, then I saw that the sf::RenderStates class has a constructor that takes a pointer to a sf::Shader and thus you indeed need to call draw(obj, &shader), which invokes that said constructor, creates a sf::RenderStates class and passes it as reference to the draw call. I don't know why the constructor takes pointers rather than references...
But if you use a RenderStates object yourself you shouldn't need to pass the adress. ;)
« Last Edit: September 06, 2012, 01:06:49 pm by eXpl0it3r »
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Foaly

  • Sr. Member
  • ****
  • Posts: 453
    • View Profile
Re: SFML 2.0 RC
« Reply #183 on: September 06, 2012, 01:03:04 pm »
Yeah it works! Look closer :) Here is why: if you pass a shader the second argument to the draw function it is passed on to the constructor of the RenderStates, which has a constructor that takes a shader as a argument. Really nice shortcut :)

edit: But still, the constructor of the RenderStates only takes a pointer to a shader. So I think there is an error in the documentation.
« Last Edit: September 06, 2012, 01:04:54 pm by Foaly »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: SFML 2.0 RC
« Reply #184 on: September 06, 2012, 01:06:21 pm »
Yeah it works! Look closer :) Here is why: if you pass a shader the second argument to the draw function it is passed on to the constructor of the RenderStates, which has a constructor that takes a shader as a argument. Really nice shortcut :)
Yep, noticed that myself... ;D

edit: But still, the constructor of the RenderStates only takes a pointer to a shader. So I think there is an error in the documentation.
Yep, it's a mistake, but I wonder why use a pointer instead of a reference?
« Last Edit: September 06, 2012, 01:11:50 pm by eXpl0it3r »
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Foaly

  • Sr. Member
  • ****
  • Posts: 453
    • View Profile
Re: SFML 2.0 RC
« Reply #185 on: September 06, 2012, 01:15:24 pm »
Yep, noticed that myself... ;D
Yeah it is kinda tricky, but a really cool shortcut!
Yep, it's a mistake, but I wonder why use a pointer instead of a reference?
I haven't thought about that... Maybe there is a reason for it. We'll see what Laurent says :)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: SFML 2.0 RC
« Reply #186 on: September 06, 2012, 01:20:23 pm »
The reason is simple: null pointer = no shader.

I'm going to fix the doc, thanks ;)
Laurent Gomila - SFML developer

Foaly

  • Sr. Member
  • ****
  • Posts: 453
    • View Profile
Re: SFML 2.0 RC
« Reply #187 on: September 06, 2012, 01:25:53 pm »
... makes sense :D

No Problem. I'm glad I was able help :)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: SFML 2.0 RC
« Reply #188 on: September 06, 2012, 04:51:19 pm »
In fact it was already fixed, the online doc is just outdated.
Laurent Gomila - SFML developer

pdinklag

  • Sr. Member
  • ****
  • Posts: 330
  • JSFML Developer
    • View Profile
    • JSFML Website
Re: SFML 2.0 RC
« Reply #189 on: September 19, 2012, 07:42:41 pm »
I got Windows 8 Professional from my university and will install it sometime later this week. So unless anybody has done this already, I will soon let you know if SFML works well on Windows 8. ;)
JSFML - The Java binding to SFML.

Andrei15193

  • Guest
Re: SFML 2.0 RC
« Reply #190 on: September 25, 2012, 12:57:12 pm »
I got Windows 8 Professional from my university and will install it sometime later this week. So unless anybody has done this already, I will soon let you know if SFML works well on Windows 8. ;)
It works, even on Intel GPU (I have a MSI U123 Wind with 1Gb of RAM and Intel Atom 1.66 Ghz and Intel GPU). If I try to compile and run the same code I have on Ubuntu it crashes (some OpenGL crash), so... go go Win8.

Also, I am using VS2012 Pro using SFML .dll files from VS2010 download, so far they work (RenderTexture, RenderWindow, Sprite, Events it's all I've tried out yet).

Off topic:
Before installing Win8, if you want to use Metro style apps you need a min 1024x768 screen res to run them. My notebook doesn't have that res but installing software the old fashion way and runing them from desktop works just fine.

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
Re: SFML 2.0 RC
« Reply #191 on: September 27, 2012, 09:22:17 pm »
It works just fine on Windows 8, even rbSFML does, already tried ;)

Though cmake don't like Visual Studio 11 yet(2012)
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: SFML 2.0 RC
« Reply #192 on: September 27, 2012, 10:56:27 pm »
Though cmake don't like Visual Studio 11 yet(2012)
What do you mean by that?
I've no problems with VS11 and CMake. Do you have the latest CMake version?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
Re: SFML 2.0 RC
« Reply #193 on: September 27, 2012, 11:27:14 pm »
Don't know, might have done something wrong cause it just didn't want to generate the needed files. Gave some error I don't remember but that didn't make sense.
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: SFML 2.0 RC
« Reply #194 on: September 27, 2012, 11:34:25 pm »
Don't know, might have done something wrong cause it just didn't want to generate the needed files. Gave some error I don't remember but that didn't make sense.
Yeye it's always the fault of the software... :P ;D
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/