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

Pages: 1 [2]
16
Graphics / Re: Weird lines in particle test
« on: December 01, 2013, 09:36:39 pm »
Interesting...


Why's this?

17
Graphics / Re: Weird lines in particle test
« on: December 01, 2013, 08:34:40 pm »
Oh, I've made shapes out of vertexes before and they do not appear. I've tried seeding the generator and that hasn't changed it.

18
Graphics / Re: Weird lines in particle test
« on: December 01, 2013, 07:26:52 pm »
Hm, what compiler are you using?

Altering the way that the particles are spread does not alter the lines in the window and the lines don't move with the particles, they stay stationary. All of my drivers are up to data.

19
Graphics / Weird lines in particle test
« on: December 01, 2013, 05:40:23 pm »
Hello, I've wanted to make a small particle system in SFML. I created the first version using the sf::RectangleShape class to make the little particles and it worked fine but was quite slow (started impacting FPS at around 1500 particles) so I re-wrote a bit of it using vertex arrays which appears to be much faster but the actual window has weird black lines in it:



Here's my source file, please note that this is only a rough experiment and so is a bit messy:

Code: [Select]
#include <iostream>
#include <string>
#include <stdio.h>
#include <vector>
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>
#include <SFML/Audio.hpp>
using namespace std;
sf::Vector2f Randomize(int Boundary1, int Boundary2)
{
    return sf::Vector2f((0 +((rand() % Boundary1))), (0 +((rand() % Boundary2))));
}

int RandomizeInt(int Boundary1, int Boundary2)
{
    return (Boundary1 +((rand() % Boundary2)));
}

struct PI
{
    sf::Color Colour = sf::Color::Yellow;
    int X = 0;
    int Y = 0;
    int LifeTime = 20000;
};

int main()
{
    int FPS = 0; //Setting up variables for measuring the FPS
    sf::Clock FPSClock;
    sf::Time FPSTime;

sf::Music music;
if (!music.openFromFile("sound.ogg"))
    return -1; // error
music.play();



    bool MousePressed = false;
    sf::Clock EffectClock;
    sf::Time EffectTime;

    int ActiveParticles = 0; //How many particles are active

    int ParticleCap = 0; //The limit of how many particles can be placed
    cout << "\nParticle Cap: ";
    cin >> ParticleCap;

    PI ParticleInfo[ParticleCap]; //Our particle information such as colour and lifetime.

    sf::VertexArray Pixel(sf::Points, ParticleCap);

    sf::RenderWindow window(sf::VideoMode(800, 600), "Partical System");
    window.setVerticalSyncEnabled(true);

    while (window.isOpen())
    {
        sf::Vector2i MousePosition = sf::Mouse::getPosition(window); //Storing mouse coords for later use

        if (sf::Mouse::isButtonPressed(sf::Mouse::Left) && MousePressed == false) //Checking if mouse is pressed
        {
            for(int a = 0; a < ParticleCap; a++) //Updating particle information
            {
                Pixel[a].position = sf::Vector2f(MousePosition.x,MousePosition.y);
                ParticleInfo[a].X = MousePosition.x;
                ParticleInfo[a].Y = MousePosition.y;
            }
            MousePressed = true;

            EffectClock.restart();
        }
        else if(!sf::Mouse::isButtonPressed(sf::Mouse::Left) && MousePressed == true)
        {
            MousePressed = false;
        }

        sf::Event event; //Polling window events to check for user input
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();
        }

        EffectTime = EffectClock.getElapsedTime();
        for(int a = 0; a < ParticleCap; a++) //Updating particle information
        {

            ParticleInfo[a].LifeTime = RandomizeInt(0,40);
            ParticleInfo[a].X = ParticleInfo[a].X + RandomizeInt(0,6) - 3;
            ParticleInfo[a].Y = ParticleInfo[a].Y + RandomizeInt(0,6) - 3;
            Pixel[a].color = ParticleInfo[a].Colour;
            if(EffectTime.asMilliseconds() > ParticleInfo[a].LifeTime)
            {
                //Pixel[a].position = sf::Vector2f(-1,-1);
                ParticleInfo[a].X = MousePosition.x;
                ParticleInfo[a].Y = MousePosition.y;
                Pixel[a].position = sf::Vector2f(ParticleInfo[a].X, ParticleInfo[a].Y);
                EffectClock.restart();
            }
            else
            {
                Pixel[a].position = sf::Vector2f(ParticleInfo[a].X, ParticleInfo[a].Y - 6);
                ParticleInfo[a].Y = ParticleInfo[a].Y - 6;
            }
        }


        window.clear(sf::Color::Black);
        window.draw(Pixel);
        window.display();


        FPS++; //Calculating FPS and displaying it
        FPSTime = FPSClock.getElapsedTime();
        if(FPSTime.asSeconds() >= 1)
        {
            cout << "\nFPS: " << FPS << endl;
            FPSClock.restart();
            FPS = 0;
        }
    }

    return 0;
}


Why is this?

20
General / Re: Program crash on start
« on: May 29, 2013, 07:54:47 pm »
Ok, yes... It was a faulty dll. I downloaded the latest one. And it worked.

21
General / Program crash on start
« on: May 29, 2013, 07:25:28 pm »
Hello, I've recently upgraded SFML to version 2.0 but have been unable to successfully run any compiled programs (the example one, or any other). I'm using MinGW 4.7 32 Bit. I've recompiled SFML, it's set up properly; I've re-done it about 5 times... Everything compiles correctly but as soon as I run the program I get:

Program.exe has stopped working. Debug. Close program. I'm using windows 8 64 Bit.
When I press close program the console says:
Process has returned 255.
If I close the program as soon as it stops responding I get:
Process returned -1073741819 (0xC0000005).

Here's the compile Log:

mingw32-g++.exe   -IC:\Users\..\Desktop\SFML-2.0\include  -c C:\Users\..\Desktop\SFML\Program.cpp -o C:\Users\..\Desktop\SFML\Program.o
mingw32-g++.exe -LC:\Users\..\Desktop\SFML-2.0\lib  -o C:\Users\..\Desktop\SFML\Program.exe C:\Users\..\Desktop\SFML\Program.o  -lgdi32 -lwinmm  -lsfml-graphics -lsfml-window -lsfml-system
Process terminated with status 0 (0 minutes, 3 seconds)
0 errors, 0 warnings (0 minutes, 3 seconds)
 
Checking for existence: C:\Users\..\Desktop\SFML\Program.exe
Executing: C:\Program Files (x86)\CodeBlocks/cb_console_runner.exe "C:\Users\..\Desktop\SFML\Program.exe" (in C:\Users\..\Desktop\SFML)
Process terminated with status 255 (1 minutes, 24 seconds)
 
Checking for existence: C:\Users\..\Desktop\SFML\Program.exe
Executing: C:\Program Files (x86)\CodeBlocks/cb_console_runner.exe "C:\Users\..\Desktop\SFML\Program.exe" (in C:\Users\..\Desktop\SFML)
Process terminated with status -1073741819 (2 minutes, 9 seconds)

 
What could be the problem? I've been trying to figure it out for hours...


EDIT:
I just opened it in a debugger and got:
Unhandled exception at 0x6FC81823 (libstdc++-6.dll) in Program.exe: 0xC0000005: Access violation reading location 0x0000000C.

Is that something to do with a faulty DLL?

Pages: 1 [2]
anything