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

Author Topic: List of 'How do I' questions...  (Read 5003 times)

0 Members and 2 Guests are viewing this topic.

Joshua Flynn

  • Full Member
  • ***
  • Posts: 133
    • View Profile
List of 'How do I' questions...
« on: August 23, 2011, 07:05:41 pm »
Although I can't find an FAQ for this sort of thing, maybe there should be a quick-reference FAQ somewhere for this sort of thing. I've got numerous questions and anyone can answer whichever they want:

Graphical:

1. How do I lock an SFML window so it cannot be resized?

2. Is it possible to lock an SFML window so it can be resized, but only diagonally, or within certain limits (EG no bigger than 800x600 and no smaller than 400x500)? If so, how?

3. If I do make an SFML window that is resizeable, what considerations must I take into account? How do I compensate?

4. Can I load models in SFML OpenGL?
4a. What kind of models?
4aa. What tool do I use to create said models?
4b. What function(s)/code would I use to do this?

5. Can SFML OpenGL save/create models? If so, how?

6. How do I find the maximum (current) resolution of the user's screen?

7. Why is there an image resolution limit, if programs like paint, for example, can have larger (and stupidly large) resolutions than that?

Sound

1. Can SFML convert/save between different formats?

Networking:

1. In simplistic terms, what is the 'nagle' problem?

2. Is it possible to send files to other people using SFML?
2a. If so, how?
2b. What considerations do I need to take into account?

Licence:

1. Is SFML (and the various systems it uses) permitted in it's licence to be sold commercially (as part of a software program)?

2. Does it require any modifications be made public or openly available?

Misc.

1. Can SFML compress files?

2. Does SFML have any in-built AI or anything similar?


Thank you for any answers. If I think of any more I'll post them.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
List of 'How do I' questions...
« Reply #1 on: August 23, 2011, 07:27:18 pm »
Quote
1. How do I lock an SFML window so it cannot be resized?

The third argument of constructor or Create function is the style, this is where you can disable borders and maximize buttons.

Quote
2. Is it possible to lock an SFML window so it can be resized, but only diagonally, or within certain limits (EG no bigger than 800x600 and no smaller than 400x500)? If so, how?

You can adjust the size of a window programatically (Window::SetSize) after it is resized manually, but not during the resize operation.

Quote
3. If I do make an SFML window that is resizeable, what considerations must I take into account? How do I compensate?

?
What are you talking about?

Quote
4. Can I load models in SFML OpenGL?

Quote
5. Can SFML OpenGL save/create models? If so, how?

No, SFML has nothing for 3D.

Quote
6. How do I find the maximum (current) resolution of the user's screen?

Maximum and current are not the same thing ;)
The maximum resolution is the first item in the list returned by VideoMode::GetFullscreenModes.
The current resolution is returned by VideoMode::GetDesktopMode.

Quote
7. Why is there an image resolution limit, if programs like paint, for example, can have larger (and stupidly large) resolutions than that?

Because an image in SFML is directly connected to an OpenGL texture so that it can be rendered -- and OpenGL textures have a maximum size (imposed by the graphics card driver).

Quote
1. Can SFML convert/save between different formats?

Yes. All the supported formats can be loaded and saved.

Quote
1. In simplistic terms, what is the 'nagle' problem?

This is rather the Nagle's algorithm. It groups small packets so that they are sent together, which reduces the network overhead. The drawback is that it can create latency (because a small packet may not be sent immediately).

Quote
2. Is it possible to send files to other people using SFML?
2a. If so, how?
2b. What considerations do I need to take into account?

SFML allows you to send sequences of bytes, whether they are from a string message or a file doesn't really matter.

Quote
1. Is SFML (and the various systems it uses) permitted in it's licence to be sold commercially (as part of a software program)?

Yes.

Quote
2. Does it require any modifications be made public or openly available?

No.

Quote
1. Can SFML compress files?

No (although you can find such features hidden somewhere in the very first SVN revisions :D)

Quote
2. Does SFML have any in-built AI or anything similar?

Absolutely not, SFML focuses on multimedia ;)
Laurent Gomila - SFML developer

Joshua Flynn

  • Full Member
  • ***
  • Posts: 133
    • View Profile
List of 'How do I' questions...
« Reply #2 on: August 23, 2011, 07:46:39 pm »
Quote from: "Laurent"
Quote
3. If I do make an SFML window that is resizeable, what considerations must I take into account? How do I compensate?

?
What are you talking about?


SFML, when resizing, normally scales the items to fit, but surely this would cause problems, such as issues with getting the mouse X/Y co-ordinates, or placement of sprites? I am not sure what problems it would cause in particular, just what issues I need to be aware of when resizing the window?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
List of 'How do I' questions...
« Reply #3 on: August 23, 2011, 08:02:14 pm »
The RenderWindow::ConvertCoords function solves this problem, it converts mouse coordinates to "scene" coordinates.

And you can change the default behaviour of scaling contents, you can instead adjust the view so that a bigger area is displayed.
Laurent Gomila - SFML developer

Joshua Flynn

  • Full Member
  • ***
  • Posts: 133
    • View Profile
List of 'How do I' questions...
« Reply #4 on: August 24, 2011, 09:04:27 am »
With OpenGL, how do I:

1. Create a subtle oblate spheroid.

2. Texture said spheroid.

3. Rotate said spheroid, so it is angled and rotated like earth on it's axis.

Thank you for the help so far - I just have a broad base of topics to cover in a short time.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
List of 'How do I' questions...
« Reply #5 on: August 24, 2011, 09:20:28 am »
3D with OpenGL is a little off-topic here, there are millions of good tutorials or even books that will help you much more than this forum. You can't learn OpenGL basics by asking questions on a forum, really ;)
Laurent Gomila - SFML developer

Joshua Flynn

  • Full Member
  • ***
  • Posts: 133
    • View Profile
List of 'How do I' questions...
« Reply #6 on: August 24, 2011, 02:00:39 pm »
Quote from: "Laurent"
3D with OpenGL is a little off-topic here, there are millions of good tutorials or even books that will help you much more than this forum. You can't learn OpenGL basics by asking questions on a forum, really ;)


Okay. Thank you. I'll try to keep questions SFML specific.

Joshua Flynn

  • Full Member
  • ***
  • Posts: 133
    • View Profile
List of 'How do I' questions...
« Reply #7 on: August 25, 2011, 07:33:09 pm »
For the function GetField in the response header, what does GetField return you supply it with a field that doesn't exist? It is a zero length std::string or something else?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
List of 'How do I' questions...
« Reply #8 on: August 25, 2011, 09:24:25 pm »
Yes, it is an empty string.
Laurent Gomila - SFML developer

Joshua Flynn

  • Full Member
  • ***
  • Posts: 133
    • View Profile
List of 'How do I' questions...
« Reply #9 on: August 30, 2011, 10:30:01 pm »
Hi. I've been tracing a crash with the code I've been writing, and after narrowing it down, I find any operations to a std::string result in a crash (this is in a class that is built normally so it isn't a memory allocation issue), and SetHost also causes the crash.

Curiously, I have not had such crashes before, and before you consider dynamic memory allocation at fault, the class I've built doesn't use dynamic memory allocation, and bypassing anything that does, the program still crashes on SetHost or modification to a std::string class.

After doing a quick search online, I found this article by microsoft on potential crashes of the STL std::string on multi-threaded machines.

http://support.microsoft.com/kb/813810

Note I am however working with Code::Blocks. Assuming std::string is the problem, how would I resolve this given SFML heavily relies on it? I have never trusted std::string personally, which is why I always implement my own dynamic string classes.

Joshua Flynn

  • Full Member
  • ***
  • Posts: 133
    • View Profile
List of 'How do I' questions...
« Reply #10 on: August 30, 2011, 10:35:50 pm »
Example code, although pseudo supplied:

Code: [Select]

const bool SetHostName()
        {
           std::cout<<"Here1\n";


            std::string Temp;
            std::cout<<"Here2!\n";
            //Reaches 'here2' before crashing
            Temp.resize(40);
            std::cout<<"HereA!\n";

            std::cout<<"HereB!\n";

            Http.SetHost(Temp);

            std::cout<<"HereC!\n";
            return true;
        }


It prints here1, and here2, then crashes. Always.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
List of 'How do I' questions...
« Reply #11 on: August 30, 2011, 11:14:45 pm »
Crashes in the standard library are often (if not always) caused by a bad configuration: mixing different versions, corrupted installation, using incompatible project settings, etc.
Laurent Gomila - SFML developer

Joshua Flynn

  • Full Member
  • ***
  • Posts: 133
    • View Profile
List of 'How do I' questions...
« Reply #12 on: August 30, 2011, 11:22:16 pm »
Quote from: "Laurent"
Crashes in the standard library are often (if not always) caused by a bad configuration: mixing different versions, corrupted installation, using incompatible project settings, etc.


Well, not sure if it is any help, but what I find incredibly weird is only one specific suppied hostname/subname combo causes the error. If I change a letter (or add in a redundant second backslash) the crash doesn't occur. If I supply a longer or shorter URL, it doesn't crash. Even if I supply a URL the exact same size (different wording), it does not crash.

Somehow it is the specific URL I give it for an ionospheric mapping website. It isn't the page loading that crashes it, as it never gets there (and if it does, it's actually successful).

So any thoughts why a specific URL that hasn't even been processed would cause a crash?

 

anything