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

Author Topic: Are shapes even drawable in 2.0...?  (Read 15779 times)

0 Members and 3 Guests are viewing this topic.

ResidentBiscuit

  • Newbie
  • *
  • Posts: 11
    • View Profile
    • Email
Are shapes even drawable in 2.0...?
« 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.
« Last Edit: July 13, 2012, 03:26:28 pm by ResidentBiscuit »

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: Are shapes even drawable in 2.0...?
« Reply #1 on: July 13, 2012, 04:30:36 am »
Code: [Select]
window.draw(ball);
window.clear();
window.display();
Need I say more?
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

ResidentBiscuit

  • Newbie
  • *
  • Posts: 11
    • View Profile
    • Email
Re: Are shapes even drawable in 2.0...?
« Reply #2 on: July 13, 2012, 04:34:22 am »
Yes, cause I have no idea what you mean.

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: Are shapes even drawable in 2.0...?
« Reply #3 on: July 13, 2012, 04:57:32 am »
According to the documentation you are doing something wrong: window.clear()

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.
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

ResidentBiscuit

  • Newbie
  • *
  • Posts: 11
    • View Profile
    • Email
Re: Are shapes even drawable in 2.0...?
« Reply #4 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.

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: Are shapes even drawable in 2.0...?
« Reply #5 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.
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

ResidentBiscuit

  • Newbie
  • *
  • Posts: 11
    • View Profile
    • Email
Re: Are shapes even drawable in 2.0...?
« Reply #6 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.

Acrobat

  • Full Member
  • ***
  • Posts: 153
    • View Profile
Re: Are shapes even drawable in 2.0...?
« Reply #7 on: July 13, 2012, 08:46:14 am »
you have to :
-clear
-draw
-display

not
-draw
-clear
-disply

mastodona7x

  • Newbie
  • *
  • Posts: 21
    • View Profile
Re: Are shapes even drawable in 2.0...?
« Reply #8 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

ResidentBiscuit

  • Newbie
  • *
  • Posts: 11
    • View Profile
    • Email
Re: Are shapes even drawable in 2.0...?
« Reply #9 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.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: Are shapes even drawable in 2.0...?
« Reply #10 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.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

ResidentBiscuit

  • Newbie
  • *
  • Posts: 11
    • View Profile
    • Email
Re: Are shapes even drawable in 2.0...?
« Reply #11 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.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: Are shapes even drawable in 2.0...?
« Reply #12 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]
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

ResidentBiscuit

  • Newbie
  • *
  • Posts: 11
    • View Profile
    • Email
Re: Are shapes even drawable in 2.0...?
« Reply #13 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?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Are shapes even drawable in 2.0...?
« Reply #14 on: July 13, 2012, 06:49:36 pm »
Can you run the Pong example of the SFML SDK?
Laurent Gomila - SFML developer

 

anything