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

Pages: [1] 2
1
General / Re: SFML issue Code::Blocks and static libraries
« on: August 04, 2014, 09:14:00 am »
You don't need this tutorial. If you don't have lastest realase of C::B, you should download it.
In Code::Blocks 13.12 you have updated SFML Project, you just need to select
New Project...->SFML Project->sfml 2.0 and give a path to sfml 2.1 main folder.
That's all.  :)

2
Graphics / Re: sf::RenderTexture problem
« on: August 03, 2014, 10:12:10 pm »
Yes, I did.
EDIT: New informations, I setted project to dynamic libs and indeed it's  working without glResetStates().

4
Graphics / Re: sf::RenderTexture problem
« on: August 03, 2014, 09:17:07 pm »
I compiled sources (CMAKE + C::B), created new sfml project in C::B, tried and I have the same problem as before (without resetGLStates()). Maybe I'm doing something wrong, but I didn't want to mislead anyone.  :-X
Or sources from this page, is not what I had to compile: http://sfml-dev.org/download.php???
If I must get it directly from github, then I'll try again. In edit I'll write if it's working or not.

5
Graphics / Re: sf::RenderTexture problem
« on: August 03, 2014, 10:54:12 am »
Thanks Nexus, good to know about RAII :).
EDIT: First video clip is without glResetStates(), second with.

6
Graphics / Re: sf::RenderTexture problem
« on: August 03, 2014, 10:27:54 am »
It's the same as in first post, but before app.clear() line, I wrote app.resetGLStates() as Alex proposed.
EDIT: I edited first post.

7
Graphics / Re: sf::RenderTexture problem
« on: August 03, 2014, 10:13:09 am »
Why not.
#ifdef SFML_STATIC
#pragma comment(lib, "glew.lib")
#pragma comment(lib, "freetype.lib")
#pragma comment(lib, "jpeg.lib")
#pragma comment(lib, "opengl32.lib")
#pragma comment(lib, "winmm.lib")
#pragma comment(lib, "gdi32.lib")  
#endif // SFML_STATIC

#include <SFML/Graphics.hpp>
#include <SFML\OpenGL.hpp>
#include "include/Defaults.hpp"
#include "include/Debug.hpp"
#include "include/FPS.h"
#include "include/Timer.hpp"
#include "include/Camera.hpp"
#include "include/Animation.hpp"
#include "include/Collision.hpp"
#include "include/Object.hpp"
#include "include/Player.hpp"
#include "include/Scene.hpp"


int main()
{
        sf::RenderWindow window(sf::VideoMode(Default::windowWidth, Default::widnowHeight),
                                                        Default::windowTitle, Default::windowStyle);
        window.setFramerateLimit(60);

        Scene test(sf::Vector2f(400,300));
        sf::Texture * tex = new sf::Texture();
        tex->loadFromFile("gfx/test.png");
        Animation anim;
        anim.setImage(tex, 64);
        anim.setOrigin(32, 32);
        Player hero(sf::Vector2f(64,64),anim);
        test.add(&hero);



        while (window.isOpen())
        {
                sf::Event event;

                while (window.pollEvent(event))
                {
                        if (event.type == sf::Event::Closed)
                                window.close();
                        hero.eventUpdate(event);
                }
                FPS::update();
                window.resetGLStates();
                hero.update(FPS::dt);
                window.clear(sf::Color::Black);
                test.draw(window);
                window.display();
        }

        delete tex;
        return 0;
}
 

Scene::Scene(sf::Vector2f Size)
{
        previous = NULL; // previous scene pointer
        next = NULL;
        name = "";
        this->Size = Size;
        camera.setCenter(Default::windowWidth / 2, Default::widnowHeight / 2);
        surface.create(Size.x,Size.y, true); // sf::RenderTexture
        surfaceRenderer.setPosition(0, 0); // sprite for render sf::RenderTexture
        surfaceRenderer.setTexture(surface.getTexture());
}
//...
void Scene::draw(sf::RenderWindow & window)
{
        surface.clear(sf::Color::White);
        surface.draw(objects.back()->getAnimation());
        surface.display();
       
        window.draw(surfaceRenderer);
}
 

8
Graphics / Re: sf::RenderTexture problem
« on: August 03, 2014, 05:42:56 am »
Quote
Try to reset the openGL states before you are drawing/clearing the rendertexture. (I have the same issue)
It's working!  :D
Thanks Alex.

9
Graphics / Re: sf::RenderTexture problem
« on: August 02, 2014, 07:11:29 pm »
Nope, I still have the same problem.  :-\

10
Graphics / Re: sf::RenderTexture problem
« on: August 02, 2014, 05:21:57 am »
Quote
Worst.texture.ever.
Just Code::Blocks SFML project, for test.  :D
I'm using SFML 2.1 :)

11
Graphics / sf::RenderTexture problem
« on: August 01, 2014, 09:14:14 pm »
Is hope it is not normal for sf::RenderTexture:

Can I fix it somehow, or what I'm doing wrong ?

Graphics Card: Radeon HD 5570
Lastest drivers.

#include <SFML/Graphics.hpp>

int main()
{
    sf::RenderWindow app(sf::VideoMode(800,600),"RT Test");
    // Load a sprite to display
    sf::Texture texture;
    if (!texture.loadFromFile("cb.bmp"))
        return EXIT_FAILURE;
    sf::Sprite sprite(texture);

    sf::RenderTexture rt;
    rt.create(800,600);

    sf::Sprite surface(rt.getTexture());

        // Start the game loop
    while (app.isOpen())
    {
        // Process events
        sf::Event event;
        while (app.pollEvent(event))
        {
            // Close window : exit
            if (event.type == sf::Event::Closed)
                app.close();
        }
        sprite.move(0.1f,0);
        // app.resetGLStates(); // with this, all work
        rt.clear(sf::Color::White);
        rt.draw(sprite);
        rt.display();


        // Clear screen
        app.clear();

        // Draw the sprite
        app.draw(surface);

        // Update the window
        app.display();
    }

    return 0;
}
 

12
Graphics / Re: Particles, Bluring
« on: July 30, 2014, 11:41:39 am »
I read the tutorial again but more precisely, and:
Okay... sorry for my stupidity.  ::)
Now it's working, as should  :D. Sorry for taking your valuable time.
Now I can create simple particle system for my games.  ;D
Thanks, and have a good day.  ;)

13
Graphics / Re: Particles, Bluring
« on: July 30, 2014, 10:57:07 am »
Quote
Why do you ask for SPARK then? ???
It was just example.  :)
Ok, thanks I'll take a look at Thor.
I created a particle system, based on sf::Quads, but I wanted to know, how can I blur my particles like in yt viedo, or texture it. I'm asking, beacuse when I draw my particles with Gaussian Blur shader, my quads are just vanishing. When I texture it, one quad is one pixel so to create something like on the screen:
http://oi61.tinypic.com/104ntc4.jpg
I must to create width*height*4 vertices for one big textured particle, right ?
Generally, I want to have two options. Texture particle, and create an effect with that, or just lay on particles an shader (for example blur, like in this video: ).
So to create (textured) particle system based on vertices, is something like texture_width*texture_height*4*particle_count vertices a good idea ? That's my final question.  And it's not my first time, when I'm using particles, but I've never tried to create any particle system by myself.

14
Graphics / Re: Particles, Bluring
« on: July 29, 2014, 09:25:13 pm »
Oh, but i don't want to use anything.  ;)
I knowed about thor long ago, but I want to create particle system by myself.
And like I wrote:
Quote
On the demo, we can see fire particles:
http://oi61.tinypic.com/104ntc4.jpg
It's an texture, but how can I make something like that ?
I want quad particles, which I can texture like that, when it's needed.
What should I use ?

EDIT: It's can be something like that too:

Quads + perlin noise and blur.

15
Graphics / Re: Particles, Bluring
« on: July 29, 2014, 09:15:14 pm »
What about SPARK ?
http://en.sfml-dev.org/forums/index.php?topic=829.msg6118#msg6118
On the demo, we can see fire particles:
http://oi61.tinypic.com/104ntc4.jpg
It's an texture, but how can I make something like that ?
I want quad particles, which I can texture like that, when it's needed.
What should I use ?

Pages: [1] 2
anything