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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - SoleSoul

Pages: [1] 2
1
Graphics / Re: C++ - setRadius doesn't work in the new 'for' ?
« on: July 11, 2015, 11:34:46 pm »
My bad.
Should have been
for(auto &player : Players)
 

I didn't know that.
Thanks :)

2
Graphics / [SOLVED]C++ - setRadius doesn't work in the new 'for' ?
« on: July 11, 2015, 11:30:09 pm »
What am I doing wrong?
Why does this work
#include <SFML/Graphics.hpp>

int main()
{
    sf::RenderWindow window(sf::VideoMode(800, 600), "wtf");
   
    window.setVerticalSyncEnabled(true);
   
    const unsigned int NumberOfPlayers = 4;

    sf::CircleShape Players[NumberOfPlayers];

    // Puttin the 'setRadius' inside this for makes it work
    for(unsigned int i = 0; i<NumberOfPlayers; i++)
    {
        Players[i].setRadius(50);
        Players[i].setPosition({i*100, 0});
    }
   
    while (window.isOpen())
    {
        window.clear(sf::Color::Black);
        for(auto player : Players)
            window.draw(player);
        window.display();
    }

    return 0;
}
 
and this doesn't?
#include <SFML/Graphics.hpp>

int main()
{
    sf::RenderWindow window(sf::VideoMode(800, 600), "wtf");
   
    window.setVerticalSyncEnabled(true);
   
    const unsigned int NumberOfPlayers = 4;

    sf::CircleShape Players[NumberOfPlayers];
   
    // This doesn't work!
    for(auto player : Players)
    {
        player.setRadius(50);
    }
   
    // Puttin the 'setRadius' inside this for makes it work
    for(unsigned int i = 0; i<NumberOfPlayers; i++)
    {
        Players[i].setPosition({i*100, 0});
    }
   
    while (window.isOpen())
    {
        window.clear(sf::Color::Black);
        for(auto player : Players)
            window.draw(player);
        window.display();
    }
   
    return 0;
}
 

The change is the location of 'setRadius' in the code. The second snippet results in a blank window.

Thanks

3
I *think* that this makes much sense because a large portion of the video stack of Linux is shared between the open source drivers. Since both intel and nouveau are open source drivers it is likely that they are affected by the same changes.

4
Wait a minute, a miracle!    ;D
I updated to the latest git and it seem to work perfectly with nouveau.
I'll test some more and see if it is really ok.

Just for curiousity, do you have in mind which change fixed it?

5
Sorry for not mentioning earlier, I'm using the official SFML package from Archlinux. Its version is "sfml 2.0rc1-3". Should I try manually updating it further?
(in the meantime I'm compiling from git)

And if I would have to draw using OpenGL sadly I won't be able to do it in the near future. I never used OpenGL directly before and I don't have the time to learn it and try until I find the bug. I think I'll leave it for now.

That's actually a problem for me. The nvidia blob causes other problems on my hardware so for day to day use I must use nouveau.
I thought to use RenderTexture to construct a background image from many small images and for now I can't use it. Is there a good alternative? (I'm not that experienced with SFML either)

6
I guess I'll have to actually draw stuff to see if the bug is presend also in OpenGL only applicaton.

7
I compiled the program from the link and ran it under both drivers. No error message was printed in both cases.
It finished immediately, and as I can see it is intentional because the application contains only tests.

What can  we learn from that? Maybe an OpenGL function is not implemented correctly in nouveau even if it doesn't return an error code?

Did I use the program from the link incorrectly?

8
Yeah, I wasn't expecting you to fix the driver :) I only wanted to know what to ask the nouveau guys. I guess I'll show them the source code and the results and see what they say.

Thank you!

9
With the nvidia blob it works.
Is there anything we can do?

10
I LOVE the speed of response :)
I'll try installing the nvidia binary blob and see what happens.

11
Here is the whole code:
#include <SFML/Graphics.hpp>
#include <iostream>
using namespace std;

int main()
{
        // Create the main window
        sf::RenderWindow window(sf::VideoMode(800, 600), "SFML window");

        sf::Texture t_grass;
        if(!t_grass.loadFromFile("M_03.png"))
                cout<<"ERROR: can't load file"<<endl;
        sf::Sprite s_grass(t_grass);
        s_grass.setPosition(0,0);
       
        // Prepare the ground
        sf::RenderTexture rt_ground;
        if(!rt_ground.create(500, 500))
                cout<<"ERROR: can't create render texture"<<endl;

        rt_ground.clear(sf::Color::White);
        rt_ground.draw(s_grass);
        rt_ground.display();
       
        sf::Sprite s_ground(rt_ground.getTexture());
       
        sf::Event event;

        // Start the game loop
        while (window.isOpen())
        {
                // Process events
                while (window.pollEvent(event))
                {
                        // Close window : exit
                        if(event.type == sf::Event::Closed)
                                window.close();
                }

                // Clear screen
                window.clear();
               
                window.draw(s_ground);
               
                // Update the window
                window.display();
        }

        return EXIT_SUCCESS;
}
 
And here is the result:

As you can see, it is very weird. It renders the source code upside down and distorted but it's the source code. It's not always the source code, I simply got lucky once and the dirstortions were easy to compare to the stuff on the screen.
I am probably doing something very wrong. What is it?

notes:
  • The M_03.png is a 10x10px png.
  • There is no console output at all.

Setup:
Archlinux
NVIDIA GeForce 7600GS
Nouveau open source driver

Thanks

EDIT: Just for completeness sake, this is how it should have looked like (it works using the nvidia blob):

12
Audio / Re: Accessing Musics Samples
« on: August 06, 2012, 12:33:50 pm »
Ok, thanks.

13
Audio / Re: Accessing Musics Samples
« on: June 18, 2012, 10:35:38 pm »
Ok. Thanks for your responsiveness.

I'll post my findings if I succeed.

14
Audio / Re: Accessing Musics Samples
« on: June 17, 2012, 11:01:54 pm »
Thanks.
For this functionality I would have to use another library in conjunction with SFML then. It is ok I guess. Any idea where I should look first? LibSndFile? Portaudio? I don't really know them.

15
Audio / Re: Accessing Musics Samples
« on: June 17, 2012, 10:12:04 pm »
I resorted to using SoundBuffer and loading the whole file to memory for now. It works and the synchronization is good.

If I'll find a way to do it with a stream in the near future I'll post here.

Pages: [1] 2
anything