SFML community forums

Help => Graphics => Topic started by: ResidentBiscuit on July 13, 2012, 04:11:59 am

Title: Are shapes even drawable in 2.0...?
Post by: ResidentBiscuit on July 13, 2012, 04:11:59 am
So I've had nothing but terrible luck with 2.0. I finally got some time to sit down and mess around with it again, and now I can't get anything to draw. According to the documentation, I'm doing nothing wrong (unless this is some linking issue which every bug seems to be related to).

sf::CircleShape ball;
    ball.setRadius(250);
    ball.setFillColor(sf::Color::Red);
    ball.setOutlineColor(sf::Color::Red);

    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
            {
                window.close();
            }
        }

        window.clear();
        window.draw(ball);
        window.display();
    }

I've tried it this way, tried giving it an initial position explicitly, tried creating it dynamically like that would help. All to no avail. And don't tell me to "search the forums". I have.

EDIT:
Had a piece of old code that made no sense. Not related to problem.
Title: Re: Are shapes even drawable in 2.0...?
Post by: binary1248 on July 13, 2012, 04:30:36 am
Code: [Select]
window.draw(ball);
window.clear();
window.display();
Need I say more?
Title: Re: Are shapes even drawable in 2.0...?
Post by: ResidentBiscuit on July 13, 2012, 04:34:22 am
Yes, cause I have no idea what you mean.
Title: Re: Are shapes even drawable in 2.0...?
Post by: binary1248 on July 13, 2012, 04:57:32 am
According to the documentation you are doing something wrong: window.clear() (http://sfml-dev.org/documentation/2.0/classsf_1_1RenderTarget.php#a6bb6f0ba348f2b1e2f46114aeaf60f26)

If you looked through the examples provided with SFML and understood every line of code and what they do, you would notice something different about yours. If you do not have time to understand what is so significant in the 3 lines of code I quoted although you have read the documentation, I cannot help you further.
Title: Re: Are shapes even drawable in 2.0...?
Post by: ResidentBiscuit on July 13, 2012, 05:18:59 am
Thanks for questioning my intelligence, but I do understand what these functions do. If you're implying my draw() function is in the wrong spot, I have stuck it in every conceivable spot. All to the same result. Even commented it out for shits and giggles. Same result.

So stop with your undeserved cockiness, and just tell me what I'm doing wrong, if anything. Because this worked just fine in 1.6.
Title: Re: Are shapes even drawable in 2.0...?
Post by: binary1248 on July 13, 2012, 05:52:47 am
If you're implying my draw() function is in the wrong spot, I have stuck it in every conceivable spot. All to the same result. Even commented it out for shits and giggles. Same result.
All spots except one would lead to the same result. As such your efforts to permute through all of them were unfortunately in vain. Commenting it out wouldn't cause the desired effect either. I assume you know this by now.

So stop with your undeserved cockiness, and just tell me what I'm doing wrong, if anything.
First of all, I try to help the best I can, and after reviewing your code, I saw an error in it. Posting obviously erroneous code without mentioning that you have tried other variants of it (which are also more correct) and expecting someone to help you without mentioning the error I already quoted is asking for someone to read your mind, which I can not yet do. Normally I would ask for a more complete example that I could compile for myself, however based on the aforementioned assumption I deemed it unnecessary. Now that you have asserted that making the calls in the right order also leads to the same results I would be willing to help you if there was a more complete example.

Because this worked just fine in 1.6.
If you refer to your posted code when you say "this", then no, it wouldn't have worked in 1.6 either. Getting the drawing and clearing order wrong never works, anywhere.
Title: Re: Are shapes even drawable in 2.0...?
Post by: ResidentBiscuit on July 13, 2012, 06:04:11 am
Let me reword that, similar code (some classes didn't exist in 1.6) worked just fine before.

I did mention everything I had tried, and I got no error messages. Though I did in fact post what error I was getting. After that, I have no idea what is going on.

I don't tend to ask questions often as I prefer to figure things out on my own, but I don't believe this error is on my end, and I can't seem to find anyone else having similar problems.
Title: Re: Are shapes even drawable in 2.0...?
Post by: Acrobat on July 13, 2012, 08:46:14 am
you have to :
-clear
-draw
-display

not
-draw
-clear
-disply
Title: Re: Are shapes even drawable in 2.0...?
Post by: mastodona7x on July 13, 2012, 11:31:53 am
Yeh just clear first, then draw, then display...if you clear  the display then display it what were you expecting to see ....seems pretty obvious even to me  :o ;D
Title: Re: Are shapes even drawable in 2.0...?
Post by: ResidentBiscuit on July 13, 2012, 03:08:35 pm
Do you all even read? I tried every arrangement of clear, draw, and display. None of them worked.
Title: Re: Are shapes even drawable in 2.0...?
Post by: eXpl0it3r on July 13, 2012, 03:14:10 pm
Do you all even read? I tried every arrangement of clear, draw, and display. None of them worked.
Then edit your first post! ::)

Do the examples that come with SFML work?
If so then you're doing something completly wrong.
If not then make sure that your graphics card driver is uptodate.
Title: Re: Are shapes even drawable in 2.0...?
Post by: ResidentBiscuit on July 13, 2012, 03:22:12 pm
Editing first post seems silly when there's a reply feature. Anyway, not here to argue conventions of forum use.

What I've been testing is one of the examples, just instead of displaying test I changed it to a CircleShape. The only difference. The text worked, this does not.
Title: Re: Are shapes even drawable in 2.0...?
Post by: eXpl0it3r on July 13, 2012, 03:38:45 pm
The code does work without problems on my end, so it's something on your PC.

Are your drivers uptodate?
Did you follow the exact setps described in the tutorials when setting up your project?
What system do you use?
What are your hardware specs?

[attachment deleted by admin]
Title: Re: Are shapes even drawable in 2.0...?
Post by: ResidentBiscuit on July 13, 2012, 04:46:37 pm
I updated my drivers < 6 months ago. I'm using an HP-Dv7 4285dx. Core i5 2.53 ghz, 6gb ram, and a radeon 6370m.

I doubt it's anything hardware related, as I could run OpenGL fine just a few months ago. How are you linking?
Title: Re: Are shapes even drawable in 2.0...?
Post by: Laurent on July 13, 2012, 06:49:36 pm
Can you run the Pong example of the SFML SDK?
Title: Re: Are shapes even drawable in 2.0...?
Post by: BHXSpecter on July 14, 2012, 02:56:49 am
 >:( Wow, just joined because I had a similar issue, but appears this forum is useless. Every reply seems to be insult your intelligence and then tell you to RTFM. What is the point of a forum for seeking help with SFML if you basically insult and demean the person seeking help then say RTFM? Save a lot of space on your server with this attitude as you won't need to have the forums, just plaster RTFM on every page. Though, I must thank you, with your attitude you have made me decide to go to SDL/Allegro or any other library as at least they don't insult potential users for asking questions.

Resident Biscuit, if you are just using SFML for the heck of it, I'd say lose it and find another library where the forums has fewer ass hats in it.
Title: Re: Are shapes even drawable in 2.0...?
Post by: eXpl0it3r on July 14, 2012, 12:30:24 pm
>:( Wow, just joined because I had a similar issue, but appears this forum is useless. Every reply seems to be insult your intelligence and then tell you to RTFM. What is the point of a forum for seeking help with SFML if you basically insult and demean the person seeking help then say RTFM? Save a lot of space on your server with this attitude as you won't need to have the forums, just plaster RTFM on every page.
You obviously don't understand what free help is. Everyone in here helping others takes parts from it's freetime to help others. Now if someone comes a long with a problem that has an obvious error in it (draw, clear, display) then it seems like the writer hasn't taken much time to fine a solution on it's own, because if you look at any example or the documentation or the tutorials it would get clear pretty soon what the solution should be (clear, draw, display).
Only after a discussion he states that he indeed tried the other orders. This we couldn't know.
Since he then didn't correct the mistake in the first post someone else comes along and replies without reading the already given answers and replies, spots the obvious problem and points it out.

The remaining problem is, that the code example is trivial and as posted by me, should work fine. But since the code posted isn't fully complete it could still be a problem with the creation of the window or it's hardware/software related. Thus we dig into other directions.

For other threads where we advice people to read the docs or a C++ book, we're trying to get people to understand how to help them self and fix their own problems. So we help them for self-help (capacity building) and that's more important then just fixing their things (reallife example: Africa).

Though, I must thank you, with your attitude you have made me decide to go to SDL/Allegro or any other library as at least they don't insult potential users for asking questions.
Good luck by deal with ugly APIs. :)
Title: Re: Are shapes even drawable in 2.0...?
Post by: Nexus on July 14, 2012, 02:25:01 pm
Though, I must thank you, with your attitude you have made me decide to go to SDL/Allegro or any other library as at least they don't insult potential users for asking questions.
Yeah, good argument for SDL/Allegro. I'm sure there's also the library developer himself who spends all his free time on answering almost every question within hours.

Seriously, if more users read the forum rules (http://en.sfml-dev.org/forums/index.php?topic=5559.0), there would be many more useful answers. Of course, if it requires four replies until a user manages to meaningfully describe his problem, you don't need to wonder about people gradually becoming annoyed.
Title: Re: Are shapes even drawable in 2.0...?
Post by: BHXSpecter on July 14, 2012, 04:09:35 pm
Quote
For other threads where we advice people to read the docs or a C++ book, we're trying to get people to understand how to help them self and fix their own problems. So we help them for self-help (capacity building) and that's more important then just fixing their things (reallife example: Africa).
That is my point, if you want them to help themselves why bother with a forum where people can ask for help? That is like customer support for a company telling you to figure it out on your own when their product breaks, you will move to another product that does the same thing. My issue is that you can help them help themselves, but it seems a lot of the replies come across as just rude and demeaning. When looking back at other posts I see the same pattern of posts that come across as rude/demeaning and makes me hesitant to post, not knowing if the question would get actual help or the rude/demeaning self help replies. Problem is that even when reading the docs you may miss it so you come here to ask a question to get RTFM as the reply. I've done this numerous times when reading docs and replies like binary's where he used bold on "every" immediately made me think of a parent scolding their kid.

Quote
Good luck by deal with ugly APIs. :)
SFML isn't any less ugly. I've been programming for 16 years and have never seen an API that isn't ugly. Qt, Allegro, SDL, SFML, enet, Box 2d, etc all have ugly APIs and could be improved upon in one way or another. To be honest I write wrappers for every library I use so the ugliness isn't an issue. 

Quote
Yeah, good argument for SDL/Allegro. I'm sure there's also the library developer himself who spends all his free time on answering almost every question within hours.
Well in Allegro they do because several members of the community are the developers of it. Don't know about SDL but it has so many tutorials around that I've not had to ask questions on it as of yet, but I've just started learning it too so I can't predict the future in that regard. With SFML I've only seen a few sites that link back to the tutorials for 1.6 and 2.0 or others that just basically copied these tutorials and pasted them on their page.

I'll lurk around for a while and may still ask questions I'm sure :).
Title: Re: Are shapes even drawable in 2.0...?
Post by: Nexus on July 14, 2012, 04:49:35 pm
SFML isn't any less ugly. I've been programming for 16 years and have never seen an API that isn't ugly. Qt, Allegro, SDL, SFML, enet, Box 2d, etc all have ugly APIs and could be improved upon in one way or another. To be honest I write wrappers for every library I use so the ugliness isn't an issue.
What exactly is ugly in SFML? It's a real question, because I'm interested in your criterions, as I personally have only seen very few C++ libraries with such a clean API as SFML. For me, "clean" includes points like:
And I understand eXpl0it3r. It is already more cumbersome to program with SDL/Allegro because they are written in C, with all the corresponding drawbacks. For example, there is neither automatic memory management, nor function/operator overloading, nor default parameters.
Title: Re: Are shapes even drawable in 2.0...?
Post by: Laurent on July 14, 2012, 05:41:14 pm
I understand both points of view.

It can be irritating when people obviously didn't read the documentation and tutorials. But maybe they just missed the relevant pages. Maybe they don't know what to look for because they are lost with a new API and website. In this case the best attitude is to reply with links to the relevant pages of the doc/tutorials. Expressing your irritation with RTFMs won't help anyone. And you don't have to post if it's only to be rude.

On the other side, it can be frustrating when you're a beginner to see "RTFM" or replies that imply that you're kind of stupid or lazy. But maybe you didn't take the time to write a meaningful post. If you want help, you must first read the rules, and then give as many details as possible in your post. It's really irritating to have to ask many questions in order to get the relevant information. It's also irritating to see people who don't seem to be able to do anything on their own. In my opinion, forums are meant to help people to improve their programming skills, to be able to deal with future similar errors, etc. So don't blame users that don't give a direct answer, they're just trying to help in a really meaningful way.

I'm also very interested in any comment about the ugliness of the SFML API :)
Title: Re: Are shapes even drawable in 2.0...?
Post by: ResidentBiscuit on July 14, 2012, 07:03:45 pm
OK so apparently this turned into a giant mess.

Quote
It can be irritating when people obviously didn't read the documentation and tutorials

Well, I did actually read the documentation and ended up reading every relevant tutorial. Nowhere does it have anything relating to my problem. They all assumed that there wouldn't be a problem with something so simple.

Quote
It's also irritating to see people who don't seem to be able to do anything on their own.

I actually usually don't even questions, but thanks for the assumption. Once again, I came here and asked when I pretty sure the problem had nothing to do with my code. And it didnt, considering it worked just fine on my Linux VM.

Anyway, this thread has completely turned me off from this entire library. I will not be recommending this to anyway, and I will be dropping the library myself.
Title: Re: Are shapes even drawable in 2.0...?
Post by: Grimshaw on July 14, 2012, 08:12:53 pm
Relax guys, it is always a pain the ass when a working sample doesn't run as expected..

It is already hard to grasp a new API concepts, let alone when there is something wrong with your system..

SFML comes with a great API and functionality, and also the community is decent. Don't judge everyone by such a petty detail..

The guy who made the topic could have elaborated a little more, without a doubt, and of course the answer is of corresponding quality(of course it didn't need to be a little condescending..)

Anyway, lets focus on solving his problem... That's what matters.. Not rage-comments that don't make technical sense, like API ugliness... Cmon..
Title: Re: Are shapes even drawable in 2.0...?
Post by: Nexus on July 14, 2012, 08:14:31 pm
ResidentBiscuit, I believe you misunderstood Laurent. He didn't say you did neither read the docs nor do something on your own, rather that it might be irritating if people do so (that is, a general statement). And in the sentences you omitted in the quote, he further explained what he meant.
Title: Re: Are shapes even drawable in 2.0...?
Post by: Laurent on July 14, 2012, 08:39:42 pm
Quote
Well, I did actually read the documentation and ended up reading every relevant tutorial. Nowhere does it have anything relating to my problem. They all assumed that there wouldn't be a problem with something so simple.
Like Nexus said, don't take it for yourself, that wasn't targeted to anyone in particular. Don't play the victim too much :P
But since you mention it, the doc and tutorials do have the solution. Both the main page of the doc and the "getting started" tutorials have a minimal code sample that shows how to clear/draw/display in the right order. Of course this applies only to the beginning of the discussion, after you said that you tried other combinations it became a different problem.

Quote
Once again, I came here and asked when I pretty sure the problem had nothing to do with my code. And it didnt, considering it worked just fine on my Linux VM.
Of course but you should have made it clear in your first post. All that people saw at the beginning was this totally obvious error, and thus focused on that. And again, my statement was not about you.

Quote
Anyway, this thread has completely turned me off from this entire library. I will not be recommending this to anyway, and I will be dropping the library myself.
That's your choice, but I think it's a very bad reason. It implies that you choose your tools according to your feelings, instead of the usual technical details (design of the API, documentation/tutorials, features, ...). And because you didn't like a single user's posts doesn't mean that SFML is a bad library. Although I'm the administrator, I can't control what every user says on the forum.

By the way, I tried to be helpful and asked you a question, you never answered.
Title: Re: Are shapes even drawable in 2.0...?
Post by: Grimshaw on July 15, 2012, 04:08:12 am
Quoting Laurent, and this is why this IS the library to use without a doubt. Where do we get more people like this? :)

Cheers
Title: Re: Are shapes even drawable in 2.0...?
Post by: Laurent on July 15, 2012, 09:27:17 am
I moved the "ugliness" discussion to a new thread.

http://en.sfml-dev.org/forums/index.php?topic=8544.0