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

Pages: 1 [2] 3 4 ... 29
16
System / Re: Threads
« on: March 18, 2015, 03:47:35 pm »
There are some books here but I don't know if they are good or not :

Multithread-programming.

17
Window / Re: Creating a window in a window.
« on: March 13, 2015, 04:52:53 pm »
Arf..., linux doesn't seems to be very appropriate to create more complex api. :/ (Or is  it SFML fault ?)

Now, I receive a keyreleased event even if I don't release a key, this is very annoying, I think this is related to the first bug because I don't have this problem with a single window.

And when I want to put the code to render into a thread (because the rendering time is too long with mesa opensource driver) I get the this non-sense error that I haven't called XinitThread but I've done it.

I think I'll use SDL instead of SFML to get rid of this bugs with the SFML window module but I don't know if it's possible to use opengl function manually after creating an SDL window, last time I tried the opengl function wheren't not executed.








18
Ok so I'll look into the source code of the opensource driver to see if I can't improve some things before Vulkan is released....

19
Network / Re: Crash on selector.wait() with a std::thread
« on: March 09, 2015, 07:03:28 pm »
Personally, I don't use threads anymore, even for networking, this is the source of many bugs. :/

I had a similar problem as you with std::thread, my server didn't received any messages with the UDP protocol...

Since I don't use an std::thread it works fine. :)

And I don't have a lot of experience in multi-thread programing, so if you haven't a good experience with multi-threading programming, I don't recommand it.

PS : And where did you add the listener to your selector ? You have to add it before your loop if you want that it works.

selector.add(listener);
 

20
Hi!

I have a set of faces that I want to draw, I don't want to use default opengl blending and depth test because it's a very complex scene.

I've tried to perform instanced rendering but the problem is that SFML updates the render texture each time that something is drawn and not each time that a pixel is updated with the sahder, so, I can't get the right colour for faces which overlap in my shader using instanced rendering.

So I  update the render texture each time I render a face, so I do more draw calls but it's slower.

My question is simple so, isn't there a way to update the render texture each time a pixel is written on the render teture with the shader ?

I don't know opengl very well so it's why I'm asking this question.

21
Window / Re: Creating a window in a window.
« on: February 16, 2015, 02:54:27 pm »
OS version : Ubuntu LTS 14.4 (64 bits)

SFML version : SFML-master (the one from the git repository)

I've also tried with the last stable version but same problem.

22
Window / Re: Creating a window in a window.
« on: February 16, 2015, 09:40:07 am »
Quote
does this works ?

No.  :'(

23
Window / [SFML 2.2] Re: Creating a window in a window. (On ubuntu 14.4)
« on: February 15, 2015, 09:47:31 am »
And here is a code which repoduce the bug :

int main()
{  
    RenderWindow window(sf::VideoMode(800, 600), "OpenGL");  
    RenderWindow window1(sf::VideoMode(200, 100), "test");
    window1.setVisible(false);
    RenderWindow window2(sf::VideoMode(200, 100), "test2");
    window2.setVisible(false);
    while (window.isOpen())
    {
        sf::Event event;
        while(window.pollEvent(event)) {
              if (event.type == sf::Event::Closed)
                    window.close();
        }
        window.clear();
        window.display();
    }
    return 0;
 

The second window is visible. :/ (The window which the title "test2")

24
Window / Creating a window in a window.
« on: February 15, 2015, 09:34:03 am »
Hi!

I need to create a window in a window for my game. (Confirmation and message dialogs.)

So I've just created this class :

OptionPane::OptionPane(math::Vec3f position, math::Vec3f size, const Font* font, sf::String t, TYPE type) :
                LightComponent (position, size, size * 0.5f, false),
                rw (sf::VideoMode(size.x, size.y), "Option Pane", sf::Style::Default, sf::ContextSettings(0, 0, 4, 3, 0)),
                type(type) {
                rw.getView().move(size.x * 0.5f, size.y * 0.5f, size.z * 0.5f);
                if (type == CONFIRMATION_DIALOG) {
                    yes = new Button(math::Vec2f(size.x / 100 * 70, size.y - 100), math::Vec2f(100, 50), font, "Yes", rw);
                    no = new Button(math::Vec2f(size.x / 100 * 10, size.y - 100), math::Vec2f(100, 50), font, "No", rw);
                    core::FastDelegate<bool> trigger1(&Button::isMouseInButton, yes);
                    core::FastDelegate<bool> trigger2(&Button::isMouseInButton, no);
                    core::FastDelegate<void> slot1(&OptionPane::onYesOption, this);
                    core::FastDelegate<void> slot2(&OptionPane::onNoOption, this);
                    core::Action a (core::Action::MOUSE_BUTTON_PRESSED_ONCE,sf::Mouse::Left);
                    core::Command cmd1 (a, trigger1, slot1);
                    core::Command cmd2 (a, trigger2, slot2);
                    getListener().connect("YESOPTION", cmd1);
                    getListener().connect("NOOPTION", cmd2);
                } else {
                    yes = nullptr;
                    no = nullptr;
                    core::Action a (core::Action::KEY_PRESSED_ONCE, sf::Keyboard::Return);
                    core::FastDelegate<void> slot(&OptionPane::onEnter, this);
                    core::Command cmd (a, slot);
                    getListener().connect("ONENTER", cmd);
                }
                rw.setPosition(sf::Vector2i(position.x, position.y));
                option = UNDEFINED;
                text.setFont(*font);
                text.setString(t);
                text.setColor(sf::Color::Black);
                text.setPosition(math::Vec3f(10, 10, position.z));
                text.setSize(size);
                backgroundColor = sf::Color::White;
            }
            void OptionPane::onVisibilityChanged(bool visible) {
                rw.setVisible(visible);
            }
            OptionPane::OPTION OptionPane::getOption() {
                OPTION choosenOption = option;
                option = UNDEFINED;
                return choosenOption;
            }
            void OptionPane::clear() {
                rw.clear(backgroundColor);
            }
            void OptionPane::draw(RenderTarget& target, RenderStates states) {
                if (rw.isOpen()) {
                    rw.draw(text, states);
                    if (type == CONFIRMATION_DIALOG)  {
                        rw.draw(*yes, states);
                        rw.draw(*no, states);
                    }
                    rw.display();
                }
            }
            void OptionPane::update() {
                sf::Event event;
                while(rw.pollEvent(event)) {
                    if (event.type == sf::Event::Closed) {
                        rw.setVisible(false);
                    }
                    getListener().pushEvent(event);
                }
            }
            void OptionPane::onEnter() {
                setVisible(false);
                setEventContextActivated(false);
                rw.setVisible(false);
            }
            void OptionPane::onYesOption() {
                rw.setVisible(false);
                setEventContextActivated(false);            
                option = YES_OPTION;
            }
            void OptionPane::onNoOption() {
                rw.setVisible(false);
                setEventContextActivated(false);            
                option = NO_OPTION;
            }
            void OptionPane::setText(std::string t) {
                text.setString(sf::String(t.c_str()));
            }
            OptionPane::~OptionPane() {
                rw.close();
                if (CONFIRMATION_DIALOG) {
                    delete yes;
                    delete no;
                }
            }
 

It works fine except for one point, here, I want to create two sub-windows :

m_pseudoUsed = new gui::OptionPane(Vec2f(200, 200), Vec2f(200, 100), fm.getResourceByAlias("FreeSerif"),"Pseudo already used!",gui::OptionPane::TYPE::MESSAGE_DIALOG);
    m_pseudoUsed->setVisible(false);
    m_pseudoUsed->setEventContextActivated(false);
    m_confirmInvitation = new gui::OptionPane(Vec2f(200, 200), Vec2f(200, 100), fm.getResourceByAlias("FreeSerif"),"",gui::OptionPane::TYPE::CONFIRMATION_DIALOG);
    m_confirmInvitation->setVisible(false);
    m_confirmInvitation->setEventContextActivated(false);
 

I set the visibility of my sub-windows to false, so the windows shouldn't be shown, but it's not what I see.

I see a transparent window on the main window, and the title is not always the title of my sub-windows..., this is really strange. :/

25
General / Re: SFML 2.2 fails to compile.
« on: January 16, 2015, 09:28:32 pm »
Hmmm, the blendmode sorry, not the shaders.

26
General / Re: SFML 2.2 fails to compile.
« on: January 16, 2015, 08:14:18 pm »
Ok it works with threads now but the shaders are not applied anymore. :/

Even without threads.

27
General / Re: SFML 2.2 fails to compile.
« on: January 16, 2015, 07:18:33 pm »
I've reinstalled my ubuntu and now the SFML version using xcb is compiling fine, and I've a rendering thread, with a rendering thread my FPS increase from 15 to 24!

But now, that's not all, now I've to rewrite the code of my lib with xcb. :/

And I've also to correct crash with multithreading when I update the game logic. :/

I had probably old gcc package which were still installed on my ubuntu. :/

28
Window / Re: Rendering in multithread cause crash. (On linux)
« on: January 16, 2015, 09:18:02 am »
Hmmm..., I've found why it crash, you're creating the window in the glcontext, this is very bad. :/

When I create an sf::Context into an SDL_Window, it doesn't display anything. :/

So I've to create an SDL context into each render target class. :/

29
General / Re: SFML 2.2 fails to compile.
« on: January 15, 2015, 04:21:50 pm »
I've tried the version without glew but, I get this error.

Code: [Select]
#0 0x7ffff776dfe8 (anonymous namespace)::getInternalContext()() (/usr/local/lib/libsfml-window.so.2.2.0:??)
#1 0x7ffff776e425 sf::priv::GlContext::ensureContext() () (/usr/local/lib/libsfml-window.so.2.2.0:??)
#2 0x451d79 odfaeg::graphic::Shader::getShadingLanguageVersionMajor() () (??:??)
#3 0x4081a7 _GLOBAL__sub_I__ZN6odfaeg7graphic6Shader14CurrentTextureE () (??:??)
#4 0x4d870d __libc_csu_init () (??:??)
#5 ?? 0x00007ffff5f3be55 in __libc_start_main (main=0x44d3d6 <main(int, char**)>, argc=1, argv=0x7fffffffe468, init=0x4d86c0 <__libc_csu_init>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffe458) (libc-start.c:246)
#6 0x408f29 _start () (??:??)


I think I should try SDL, I'll have to implement some interfaces (similar to the SFML ones) but I think this'll be faster than being blocked with non-sense errors.

SFML 2.1 compiles without any problem.

30
General / Re: SFML 2.2 fails to compile.
« on: January 15, 2015, 03:08:33 pm »
I've tried to recompile with fPIC but it doesn't solve the problem. :/

Pages: 1 [2] 3 4 ... 29