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 - JAKUBW

Pages: [1]
1
General / Re: sf::Text destruction causes segfault
« on: March 23, 2018, 07:38:13 pm »
No, I didn't build SFML with the same compiler. I have just typed this:
Quote
sudo apt-get install libsfml-dev
And then
Quote
g++-7 -std=c++17 -c main.cpp&&g++-7 main.o -o sfml-app -lsfml-graphics -lsfml-window -lsfml-system&&./sfml-app
Like it is in the tutorial https://www.sfml-dev.org/tutorials/2.4/start-linux.php

2
General / sf::Text destruction causes segfault
« on: March 22, 2018, 07:09:44 pm »
Hey everyone, I have got a question. Why does this code cause segfault?
#include <SFML/Graphics.hpp>
#include <iostream>

int main()
{
        {
                std::cout << 1 << std::endl;
                sf::Text text;
                std::cout << 2 << std::endl;
                text.setString("Hello world");
                std::cout << 3 << std::endl;
        }
        std::cout << 4 << std::endl;
}
 
After successfully compilation (and run) with this command:

g++-7 -std=c++17 -c main.cpp&&g++-7 main.o -o sfml-app -lsfml-graphics -lsfml-window -lsfml-system&&./sfml-app
It prints me:

Quote
1
2
3
Naruszenie ochrony pamięci
Naruszenie ochrony pamięci is Segmentation fault in polish

I use Linux Mint 64bit

3
Oh yeah, I updated files, but I didn't replace dll's...
Thank you very much :)

4
Hey

I try to create sf::RenderTexture object in std::thread method and it causes stack overflow.
My code:
#include <SFML/Graphics.hpp>
#include <thread>

int main()
{
        sf::RenderTexture texture;
        std::thread thread([]() {
                sf::RenderTexture t;
        });

        thread.join();
        return 0;
}
 
Without creating first texture it happens too.
#include <SFML/Graphics.hpp>
#include <thread>

int main()
{
        sf::RenderWindow window(sf::VideoMode(800, 600), "WINDOW");

        while (window.isOpen())
        {
                sf::Event event;
                while (window.pollEvent(event))
                {
                        if (event.type == sf::Event::Closed)
                                window.close();
                        if (event.type == sf::Event::MouseButtonPressed)//crash when button is pressed
                        {
                                std::thread thread([]() {
                                        sf::RenderTexture t;
                                });
                        }
                }
                window.clear(sf::Color(50, 50, 50));
                window.display();
        }
        return 0;
}
 
but it doesn't crash with this code:
#include <SFML/Graphics.hpp>
#include <thread>

int main()
{
        std::thread thread([]() {
                sf::RenderTexture t;
        });
        thread.join();
        return 0;
}

How to solve this problem?

SFML 2.4.2
Microsoft Visual Studio Community 2015, Version 14

5
Graphics / Getting better performance by checking what to draw.
« on: April 25, 2017, 08:14:06 pm »
Hi everyone!
I'm creating a game, not very advanced one, but there will be a lot of drawing object (Sprites etc.). Most of them are going to be out of the player's sight. I will use ordinary function - just window.draw(mySprite) and my question sounds:
Does it takes GPU when I draw sprites (or some other drawable object) which are not visible for player(out of current window's view)?
If yes:
Does SFML (or OpenGL) checks if the sprite can be visible by the player or I should take care of them and check it manually using current window's view and getGlobalBounds method?
And Does it takes GPU when I draw an fully transparent sprite (with color's alpha set to 0)?

6
Network / Re: FTP does not work in release mode.
« on: July 27, 2016, 10:52:22 am »
Build log:

-------------- Build: Release in SFML (compiler: GNU GCC Compiler)---------------

mingw32-g++.exe -Wall -O2 -IC:\Users\Jakubek\SFML\include -c C:\Users\Jakubek\Desktop\FTP\main.cpp -o obj\Release\main.o
mingw32-g++.exe -LC:\Users\Jakubek\SFML\lib -o bin\Release\SFML.exe obj\Release\main.o  -static -static-libgcc -s  -lsfml-graphics -lsfml-audio -lsfml-main -lsfml-network -lsfml-system -lsfml-window
Output file is bin\Release\SFML.exe with size 544.50 KB
Process terminated with status 0 (0 minute(s), 0 second(s))
0 error(s), 0 warning(s) (0 minute(s), 0 second(s))

7
Network / Re: FTP does not work in release mode.
« on: July 26, 2016, 03:26:44 pm »
I use SFML 2.3.2 windows gcc 4.9.2 mingw 32-bit

#0 0x6fc61225   ??() (C:\Users\Jakubek\Desktop\FTP\bin\Release\libstdc++-6.dll:??)
#1 0x6fc61662   ??() (C:\Users\Jakubek\Desktop\FTP\bin\Release\libstdc++-6.dll:??)
#2 0x6fcae634   ??() (C:\Users\Jakubek\Desktop\FTP\bin\Release\libstdc++-6.dll:??)
#3 0x6fcb1119   ??() (C:\Users\Jakubek\Desktop\FTP\bin\Release\libstdc++-6.dll:??)
#4 0x6fcb2c82   ??() (C:\Users\Jakubek\Desktop\FTP\bin\Release\libstdc++-6.dll:??)
#5 0x6fcb46bb   ??() (C:\Users\Jakubek\Desktop\FTP\bin\Release\libstdc++-6.dll:??)
#6 0x69884a39   _fu152___ZTTSt14basic_ofstreamIcSt11char_traitsIcEE() (C:\Users\Jakubek\Desktop\FTP\bin\Release\sfml-network-2.dll:??)
#7 0x47c40e   ?? () (??:??)
#8 0x4010fd   ?? () (??:??)
#9 0x770537eb   ntdll!RtlInitializeExceptionChain() (C:\Windows\system32\ntdll.dll:??)
#10 0x770537be   ntdll!RtlInitializeExceptionChain() (C:\Windows\system32\ntdll.dll:??)
#11 ??   ?? () (??:??)

And Windows 7 write: SFML.exe has stopped working.

8
Network / FTP does not work in release mode.
« on: July 26, 2016, 02:40:39 pm »
Hey all,
I am creating game and i need download additional music file from internet. I tried do it and... I did.
But there is a problem. Program works only in debug mode. When i switch to release and i try download or upload file it crashes. Code:

#include <SFML/Network.hpp>
#include <iostream>

using namespace sf;
using namespace std;

// Normally there are good texts
string login = "";
string password= "";
string adres = "";
int main()
{
    Ftp ftp;
    Ftp::Response odp = ftp.connect(sf::IpAddress(adres.c_str()),21,sf::seconds(3));
    if(odp.isOk())
        cout<<"Connected!"<<endl;
    else
    {
        cout<<"Connecting error!"<<endl;
        getchar();
        return 1;
    }
    odp = ftp.login(login,password);
    if(odp.isOk())
        cout<<"Login succes!"<<endl;
    else
    {
        cout<<"Bad login or password"<<endl;
        cin.get();
        return 1;
    }
    cout<<"Downloading..."<<endl;
    odp = ftp.download("VexentoGlow.ogg","",sf::Ftp::Binary);
    if(odp.isOk())
        cout<<"Download complete!"<<endl;
    else
        cout<<"Error!"<<endl;
    getchar();
    ftp.disconnect();
    return 0;
}
 

It crashes in:
ftp.download("VexentoGlow.ogg","",sf::Ftp::Binary);

In debug mode it works good. It is SFML bug I suppose. :)
Please help!

Pages: [1]
anything